Suppose, If I have a binding key as "a.b.*" then I can use the routing keys as a.b.1, a.b.2, a.b.3 , a.b.4 and so on.
I want the queue to accept messages from the all these routing keys except the routing key "a.b.3". How can that be implemented?
Or is there any way I can use regex for my binding key instead of just the wildcard characters "*" and "#".
Topic exchange is a built-in exchange in RabbitMQ, enabling the use of wildcards in the binding key. In RabbitMQ, messages are published to an exchange and, depending on the type of exchange, the message gets routed to one or more queues.
A fanout exchange routes messages to all of the queues that are bound to it and the routing key is ignored. If N queues are bound to a fanout exchange, when a new message is published to that exchange a copy of the message is delivered to all N queues. Fanout exchanges are ideal for the broadcast routing of messages.
Exchanges are message routing agents, defined by the virtual host within RabbitMQ. An exchange is responsible for routing the messages to different queues with the help of header attributes, bindings, and routing keys. A binding is a "link" that you set up to bind a queue to an exchange.
No; there's no regex, just the two wildcards.
You can use multiple bindings though - you would have to explicitly bind the queue with a.b.1, a.b.3, a.b.4, but then, you might as well just use a direct exchange.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With