中午调整了一台应用服务的mq ttl参数后,重启时出现如下异常:
Caused by: com.rabbitmq.client.AlreadyClosedException: channel is already closed due to channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'x-message-ttl' for queue 'QUEUE_NAME' in vhost '/': received '60000' but current is '5000', class-id=50, method-id=10)
INFO | jvm 1 | 2016/11/30 11:22:29 | WrapperSimpleApp Error: at com.rabbitmq.client.impl.AMQChannel.ensureIsOpen(AMQChannel.java:195)INFO | jvm 1 | 2016/11/30 11:22:29 | WrapperSimpleApp Error: at com.rabbitmq.client.impl.AMQChannel.rpc(AMQChannel.java:241)INFO | jvm 1 | 2016/11/30 11:22:29 | WrapperSimpleApp Error: at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:219)INFO | jvm 1 | 2016/11/30 11:22:29 | WrapperSimpleApp Error: at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:118)INFO | jvm 1 | 2016/11/30 11:22:29 | WrapperSimpleApp Error: at com.rabbitmq.client.impl.ChannelN.queueDeclare(ChannelN.java:844)INFO | jvm 1 | 2016/11/30 11:22:29 | WrapperSimpleApp Error: at com.rabbitmq.client.impl.recovery.AutorecoveringChannel.queueDeclare(AutorecoveringChannel.java:266)INFO | jvm 1 | 2016/11/30 11:22:29 | WrapperSimpleApp Error: at com.ld.net.remoting.rmq.LDMultiServiceBeanConfigurer.postProcessBeforeInitialization(LDMultiServiceBeanConfigurer.java:333)INFO | jvm 1 | 2016/11/30 11:22:29 | WrapperSimpleApp Error: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)INFO | jvm 1 | 2016/11/30 11:22:29 | WrapperSimpleApp Error: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1558)INFO | jvm 1 | 2016/11/30 11:22:29 | WrapperSimpleApp Error: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)INFO | jvm 1 | 2016/11/30 11:22:29 | WrapperSimpleApp Error: ... 18 more登录MQ控制台,MQ中该队列的TTL当前值是5000。
解决方法有两种:
1、重建该队列,并设置TTL为希望的值,如果客户端没有配置自动创建队列的话;
2、删除该队列,如果客户端配置了自动创建队列的话;