rabbitmq 消費者聲明隊列 報錯 code=406


報錯詳情

The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - inequivalent arg 'x-message-ttl' for queue 'SyncDataQueueXinhuayun' in vhost '/': received none but current is the value '604800000' of type 'long'', classId=50, methodId=10

 

原因:基本隊列里面生產者定義的隊列設置的參數和消費者代碼里面定義的隊列設置的參數不一樣導致的

                    //聲明一個隊列
                    channel.QueueDeclare(
                      queue: queueName//消息隊列名稱
                      , durable: true//是否持久化
                      , exclusive: false // 是否獨占連接
                      , autoDelete: false
                      , arguments: new Dictionary<string, object> {
                                         { "x-message-ttl",604800000} //x-message-ttl即設置當前隊列消息的過期時間。ttl即為time to live
                                 });

 

參考鏈接:

https://blog.csdn.net/fristbd/article/details/51781379


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM