報錯詳情
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
