具体异常:
Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'x-message-ttl' for queue 'queryResult' in vhost 'bedrock_i': received '100000' but current is '2000000', class-id=50, method-id=10)
原因
此处queryResult
队列mq中x-message-ttl
设置为2000000
。
代码中declareQueue代码为:
Queue queue = QueueBuilder.durable("queryResult")
.withArgument("x-message-ttl", 100 * 1000)
.withArgument("x-dead-letter-exchange", "queryResult-delay")
.withArgument("x-dead-letter-routing-key", "queryResult-delay")
.build();
rabbitAdmin.declareQueue(queue);
代码中声明的x-message-ttl
为100000
,导致声明队列异常。
标签:queryResult,代码,RabbitMQ,declareQueue,withArgument,IO,ttl,message From: https://www.cnblogs.com/colfish/p/17581765.htmldeclareQueue时设置的
x-message-ttl
一定要和rabbitmq中设置的x-message-ttl
一致