We are rebuilding our message queue system. While going over the RabbitMQ exchange types, I noticed there are two potential solutions to implement the multi-cast nature of routing messages.
Topic Exchange. By setting up a topic exchange and a routing key with specific pattern, message would be routed to the designated queues. I.E. products.*. According to the AMQP spec, this is usually the exchange type to implement Pub/Sub pattern.
Header Exchange. The so-called "Direct Exchange on Steroids". It's even more flexible to multi-cast messages in that routing key is ignored, instead each message has "x-match" header to denote which queues the message is supposed to be delivered to. And each message can be dynamically routed differently. However, this exchange type may seems a bit more tightly coupled with the Message Queue design as the consumer / producer would have to know more about the destination queues.
So the question is, has anyone experienced with both exchange types and share more characteristics of the pros/cons for the above two types? Thanks!
Reference [1]: https://www.rabbitmq.com/tutorials/amqp-concepts.html