have a docker environment where messaging service(rabbitmq) and my services(myapp) are configured in docker. I try to consume the messages published by myapp. myapp produces the messages of type "fanout" in a given message channel and in consumer code, I try setup the rabbitmq intricacies so that messages of type "fanout" can be consumed.
consumer sample:factry = newConnectionFactory();factry.setHost(MYHOST);connection.newConnection();chnl = connection.createChannel();channel.exchangeDeclare("MYEXCHG","fanout",true);.....and so on.
When consumer sets the rabbitmq thingy as shown above: I get following PRECONDITION error: Caused by:
com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'type' for exchange 'applicationStatus' in vhost '/': received 'fanout' but current is 'topic', class-id=40, method-id=10)
I have enough analysed the producer code and consumer code. Still I could not narrow down the issue. My ask here is: Can i configure the channel in such a way that I will be able to accept any type of messages sent by producer.
Say Producer P1 produces msgs from exchange type 'direct' and P2 produces msgs from exchange type 'fanout'. Can I have a common consumer code so that I will be able to receive msgs irrespective of its exchange type(i.e.,produced from P1 and P2...)
Really appreciate the help in this forum.