Igor
Igor

Reputation: 183

Selective routing with RabbitMQ

I have some queues bound to one topic exchange, e.g. with routing keys:

1) big.yellow.rabbit
2) small.*.dog
3) small.*.*
4) *.*.cat
5) *.*.*

I want the RabbitMQ to choose only one queue to place my message by following logic:

Examples for aforementioned keys:

big.yellow.rabbit -> 1) 
small.yellow.rabbit -> 3) 
small.white.cat -> 3)
big.grey.cat -> 4)
big.yellow.pig -> 5)

I've come to conclusion that common exchange types (direct, topic, fanout, headers) will not help me. And I need to implement new custom type. Am I right?

Thanks.

Upvotes: 3

Views: 1916

Answers (1)

scvalex
scvalex

Reputation: 15345

Yes, the routing logic you describe is not implemented by any of the default exchange types in RabbitMQ; you'll have to write your own.

You'll need to write a RabbitMQ plugin. More concretely, you'll need to write a custom exchange type: you can find a bunch of examples on the Developer Tools page.

If you need any pointers on how to get started or get stuck, post a question on the RabbitMQ-Discuss mailing list. The RabbitMQ developers read that list and make a point of not leaving any questions unanswered.

Upvotes: 6

Related Questions