feliperazeek/play-rabbitmq — pull request #9 by telecoda (2012-04-18 07:50:20+00:00)
Title: Allow great control over the creation of exchanges/queues/bindings

We have a requirement for doing pub/sub between several play based projects using fanout exchanges

We are publishing event messages from one application that can be consumed by multiple applications.

We wanted greater control of the creation of queues / exchanges, rather than queues being directly linked to exchanges.

Therefore we required the following:-

Application A
-------------------
Publishes messages to exchange ExchangeA - with a routing key of EntityA
It uses a RabbitMQPubPubPublisher instance to create an exchange and nothing else.

Application B & C
-------------------------
Subscribe to messages being sent to ExchangeA

There both create an instance of RabbitMQPubSubConsumer with their own specific queue names and a common exchange and routing key (EntityA).

The end result is one exchange which routes messages to two separate queues. These queues have bindings based upon the routing keys.

I created separate classes from RabbitMQConsumer & RabbitMQPublisher to permit backwards compatibility with the existing code base.