com.rabbitmq.client.ShutdownSignalException

channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'type' for exchange 'rkk_exchange1' in vhost '': received 'fanout' but current is 'topic', class-id=40, method-id=10) Below is the code (configuration file): @Configuration @Profile("cloud") public class MultiListenerRabbitConfig extends AbstractCloudConfig{ private static final String QUEUE_NAME1="rk.rkk_queue1"; private static final String QUEUE_NAME2="rk.rkk_queue2"; private static final String EXCHANGE_NAME="rkk_exchange1"; private static final int PORT = 1; @Bean public CachingConnectionFactory cachingConnectionFactory(){ CloudFactory cloudFactory = new CloudFactory(); Cloud cloud = cloudFactory.getCloud(); List<ServiceInfo> listServices = cloud.getServiceInfos(); AmqpServiceInfo serviceInfo = (AmqpServiceInfo) cloud.getServiceInfo(cloud.getServiceInfos().get(0).getId()); CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory(); cachingConnectionFactory.setUsername(serviceInfo.getUserName()); cachingConnectionFactory.setPassword(serviceInfo.getPassword()); cachingConnectionFactory.setVirtualHost(serviceInfo.getVirtualHost()); cachingConnectionFactory.setHost(serviceInfo.getHost()); cachingConnectionFactory.setPort(PORT); cachingConnectionFactory.setRequestedHeartBeat(30); cachingConnectionFactory.setConnectionTimeout(30000); return cachingConnectionFactory; } @Bean public RabbitTemplate rabbitTemplate(){ System.out.println("-----------------**************------------------ Create Rabbit Template"); RabbitTemplate template = new RabbitTemplate(cachingConnectionFactory()); return template; } @Bean public RabbitAdmin rabbitAdmin(){ //Set up queue, exchanges and bindings RabbitAdmin admin = new RabbitAdmin(cachingConnectionFactory()); Queue queue1 = new Queue(QUEUE_NAME1); admin.declareQueue(queue1); //For a Fanout Exchange, any Queue bound to that Exchange will receive any message sent to that Exchange FanoutExchange exchange = new FanoutExchange(EXCHANGE_NAME); admin.declareExchange(exchange); Binding binding = BindingBuilder.bind(queue1).to(exchange); admin.declareBinding(binding); return admin; } } Putting the stack trace: ERR Caused by: java.io.IOException

Samebug tips0

There are no available Samebug tips for this exception. If you know how to solve this issue, help other users by writing a short tip.

Don't give up yet. Paste your full stack trace to get a solution.

Solutions on the web307

  • channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'type' for exchange 'rkk_exchange1' in vhost '': received 'fanout' but current is 'topic', class-id=40, method-id=10
  • channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'type' for exchange 'tracey' in vhost '/': received 'topic' but current is 'fanout', class-id=40, method-id=10)
  • channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'xdbus.partitioned.0-0' in vhost '/': received none but current is the value 'xdbus.DLX' of type 'longstr', class-id=50, method-id=10)
  • Stack trace

    • com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'type' for exchange 'rkk_exchange1' in vhost '': received 'fanout' but current is 'topic', class-id=40, method-id=10) Below is the code (configuration file): @Configuration @Profile("cloud") public class MultiListenerRabbitConfig extends AbstractCloudConfig{ private static final String QUEUE_NAME1="rk.rkk_queue1"; private static final String QUEUE_NAME2="rk.rkk_queue2"; private static final String EXCHANGE_NAME="rkk_exchange1"; private static final int PORT = 1; @Bean public CachingConnectionFactory cachingConnectionFactory(){ CloudFactory cloudFactory = new CloudFactory(); Cloud cloud = cloudFactory.getCloud(); List<ServiceInfo> listServices = cloud.getServiceInfos(); AmqpServiceInfo serviceInfo = (AmqpServiceInfo) cloud.getServiceInfo(cloud.getServiceInfos().get(0).getId()); CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory(); cachingConnectionFactory.setUsername(serviceInfo.getUserName()); cachingConnectionFactory.setPassword(serviceInfo.getPassword()); cachingConnectionFactory.setVirtualHost(serviceInfo.getVirtualHost()); cachingConnectionFactory.setHost(serviceInfo.getHost()); cachingConnectionFactory.setPort(PORT); cachingConnectionFactory.setRequestedHeartBeat(30); cachingConnectionFactory.setConnectionTimeout(30000); return cachingConnectionFactory; } @Bean public RabbitTemplate rabbitTemplate(){ System.out.println("-----------------**************------------------ Create Rabbit Template"); RabbitTemplate template = new RabbitTemplate(cachingConnectionFactory()); return template; } @Bean public RabbitAdmin rabbitAdmin(){ //Set up queue, exchanges and bindings RabbitAdmin admin = new RabbitAdmin(cachingConnectionFactory()); Queue queue1 = new Queue(QUEUE_NAME1); admin.declareQueue(queue1); //For a Fanout Exchange, any Queue bound to that Exchange will receive any message sent to that Exchange FanoutExchange exchange = new FanoutExchange(EXCHANGE_NAME); admin.declareExchange(exchange); Binding binding = BindingBuilder.bind(queue1).to(exchange); admin.declareBinding(binding); return admin; } } Putting the stack trace: ERR Caused by: java.io.IOException at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:106) at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:102) at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:124) at com.rabbitmq.client.impl.ChannelN.exchangeDeclare(ChannelN.java:693) at com.rabbitmq.client.impl.ChannelN.exchangeDeclare(ChannelN.java:662) at com.rabbitmq.client.impl.ChannelN.exchangeDeclare(ChannelN.java:61) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.amqp.rabbit.connection.CachingConnectionFactory$CachedChannelInvocationHandler.invoke(CachingConnectionFactory.java:625) at com.sun.proxy.$Proxy50.exchangeDeclare(Unknown Source) at org.springframework.amqp.rabbit.core.RabbitAdmin.declareExchanges(RabbitAdmin.java:422) at org.springframework.amqp.rabbit.core.RabbitAdmin.access$000(RabbitAdmin.java:54) at org.springframework.amqp.rabbit.core.RabbitAdmin$1.doInRabbit(RabbitAdmin.java:111) at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1045) Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'type' for exchange 'rkk_exchange1' in vhost '': received 'fanout' but current is 'topic', class-id=40, method-id=10) at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:67) at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:33) at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:343) at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:216) at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:118) ... 16 more Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'type' for exchange 'rkk_exchange1' in vhost '': received 'fanout' but current is 'topic', class-id=40, method-id=10) at com.rabbitmq.client.impl.ChannelN.asyncShutdown(ChannelN.java:478) at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:315) at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:144) at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:91) at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:552)

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    Unknown user
    Once, 1 year ago
    Once, 2 months ago
    3 times, 6 months ago
    Unknown user
    6 times, 11 months ago
    Unknown user
    Once, 1 year ago
    10 more bugmates