Reputation: 3897
I am having some issues trying to understand how an exchange of type headers works.
Only one exchange, myExchange
Three queues:
Bindings:
I am expecting the header of the message to have multiple values; any combination of test1, test2, test3 (example: test1 alone, test1 and test2, test3 and test2, etc...)
myQueue3 only receives messages if they have myHeaders:[test1, test2, test3]. I would expect myQueue3 to get messages for, e.g. test1 and test2 as well.
myQueue1 only receives messages if they have myHeaders:[test1]. I would expect myQueue1 to get messages for, e.g. test1 and [test1, test2] as well.
Is there any way to achieve such behavior? Thank you
Upvotes: 2
Views: 3368
Reputation: 1017
You can declare multiple bindings for the same queue.
In your case the queue 3 will have three different bindings.
Upvotes: 1
Reputation: 7590
For this, I have a trick.
Bindings:
myQueue1 will receive all message with header containts {test1: true}.
myQueue2 will receive all message with header containts {test2: true}.
myQueue3 will receive all message with header containts one of this {test1: true}, {test2: true} or {test3: true}.
I prefer this, because Routing Key is limited by 255 bytes, but the limit of number of elements in header is very higth.
For performance, I don't know what it's the best.
Upvotes: 1
Reputation: 3897
I agree with the comments, I was trying to achieve something that at the moment is not supported. I will use routing keys.
Upvotes: 0