Solved

Prevent RabbitMQ Producer from creating queue with exchange

  • 15 December 2021
  • 4 replies
  • 128 views

Hello.  In one of our pipelines, we end with a call to a Rabbit MQ Producer node.  The node publishes to a fanout exchange.  Later in another application, we create a listener queue on that same exchange and listen for messages on the newly created queue.  This happens for each docker container running our application which is listening on the fanout exchange.  As a side effect, of the Rabbit MQ Producer node creating the exchange, it is also creating a queue along with it.  This results in a queue being sent all the messages that are sent to the exchange which has no consumers.  We would like to prevent this default queue from being created.  Is there a way to do that in the RabbitMQ Producer node?

 

Below I will outline the steps to try and make the situation more clear

  1. Rabbit MQ Producer node creates fanout Exchange
  2. Rabbit MQ Producer node creates queue “A” on the exchange
  3. Instance 1 of separate application creates queue “B” on the exchange
  4. Instance 2 of separate application creates queue “C” on the exchange
  5. Queues “A”, “B” and “C” get message M1
  6. Instance 1 consumes M1 off B
  7. Instance 2 consumes M1 off C
  8. Queue A still has M1 and will always have M1

We want to eliminate the existence of queue A in the above example.  It is not desirable for Instance 1 or 2 to connect to queue A.

 

Thanks for any help.

icon

Best answer by Giuseppe Mura 15 December 2021, 21:27

View original

4 replies

Userlevel 3
Badge

@jason  could you confirm, what version of Data Collector are you using? I think we made some changes in 4.2 (if I recall correctly) which might assist with this scenario.

Thank you for your quick response.  We are currently using version 3.16.0.  Do you know what changed in the newer version that would address this?  Is the creation of a queue optional with a checkbox or something?

Userlevel 3
Badge

Hi @jason , I checked and the behaviour has changed since 4.1, whereby when you specify an exchange but provide no queue name, we just connect to the exchange and don’t create a queue. So if you’ve configured your exchange to deliver messages to whatever queue you require already, we don’t end up creating an unnecessary queue.

is this the behaviour you would like to experience? 
 

if so, you’ll have to upgrade your engine, I’d recommend the latest version (4.2). If you’re using stand-alone Data Collector, you’ll need to register for the DataOps platform, easily done from our website.

if you’re already using Control Hub, you should be able to just upgrade / install a new SDC.

That’s wonderful.  Thank you very much for your help!

Reply