0
votes

Is it possible to have some "default" queue for a rabbitmq exchange with a type 'direct'?

Like, i have an exchange A and queues Q1,Q2,Q3,QDef . so if somethign is published with routing key Q1. it will go to to Q1. But if a message is with a routing key Q4 then it should go to QDef. If routing key is not name of existent queue then a message should go to QDef.

Is it possible to do with a rabbitmq? Maybe exchange should not be of a type 'direct' but some other type?

With other words. If some consumer declared a queue for some routing key then messages should go to this queue. If not then messages should go to a default consumer.

1

1 Answers

3
votes

You can obtain the intended behavior by using and alternate exchange (AE).

So you should define the AE for you exchange A and bind your queue QDef to it. Unroutable messages will be delivered to it.