Rostyslav Roshak
Rostyslav Roshak

Reputation: 4009

RabbitMQ Exchange exclude queue

I try to make chat application using RabbitMQ.

Every conversation group has fanoutexchange, to which group members push messages and bind their queues.

But with such routing members receive their own messages, so I have to filter them in the client code.

Is there any way how to make exclude pattern matching, so exchange would not send message to the queue with the same key?

Upvotes: 0

Views: 1498

Answers (2)

Derick Bailey
Derick Bailey

Reputation: 72868

Is there any way how to make exclude pattern matching

nope.

routing keys only match, not exclude

Upvotes: 1

cantSleepNow
cantSleepNow

Reputation: 10202

You could use headers exchange instead of fanout.

A headers exchange is designed for routing on multiple attributes that are more easily expressed as message headers than a routing key. Headers exchanges ignore the routing key attribute. Instead, the attributes used for routing are taken from the headers attribute. A message is considered matching if the value of the header equals the value specified upon binding.

Upvotes: 0

Related Questions