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

posted @ 2022-03-01 17:19  温故纳新  阅读(2962)  评论(1编辑  收藏  举报