我尝试用spring在RabbitMQ中发送一些消息,但是每次收到第一条消息时,我都会收到此类异常:
com.rabbitmq.client.ShutdownSignalException: channel error; protocol method:
#method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED -
inequivalent arg 'x-max-length-bytes' for queue
'queue1'
in vhost 'f46b51d8-0750-4e7e-9288-3bdb3c5dac01':
received none but current is the value '1073741824' of type 'long', class
id=50, method-id=10)
at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)
at
com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:32)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:366)
at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:229)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:117) ... 68 moreCaused by:
我没有在配置中设置x-max-length-bytes
spring.rabbitmq.host= xxxxxx
spring.rabbitmq.port= 5671
spring.rabbitmq.username= xxxxxx
spring.rabbitmq.password= xxxxxx
spring.rabbitmq.virtual-host= f46b51d8-0750-4e7e-9288-3bdb3c5dac01
spring.rabbitmq.ssl.enabled= true
rabbimq.exchange.name= ex1
rabbimq.queue.name= queue1
rabbimq.routing.key= route1
其他消息正确发送,但只有第一条消息导致此异常
有人可以帮助我吗?
答案 0 :(得分:0)
PRECONDITION_FAILED
意味着您已经声明了一个队列,并且您正在尝试使用不同的参数来重新声明同一队列。
使用管理UI或命令行检查队列:
rabbitmqctl list_queues