sustrik edited this page Sep 14, 2010 · 15 revisions
Clone this wiki locally

Pubsub pattern allows you to use RabbitMQ as an intermediate message router within your data distribution tree:

The diagram below shows the wiring of pubsub service. The big box in the middle is RabbitMQ server process. Inside there’s a RabbitMQ broker (the top box) and r0mq plugin (the bottom box). AMQP clients are little boxes on the top. 0MQ applications are small boxes at the bottom of the diagram. AMQP exchange marked in red is the “rendez-vous point” for this messaging pattern. Its name corresponds to the name specified in the r0mq configuration entry:

All the publishers publish to the same fanout exchange. AMQP publishers do so directly. 0MQ publishers are proxied by the r0mq plugin.

AMQP subscribers create a private queue that they bind to the fanout exchange and consume messages from it.

r0mq plugin behaves as a standard AMQP subscriber (it creates the private queue etc.), however, it dispatches the messages it gets to all the connected 0MQ subscribers.

Following diagram shows how message from AMQP publisher is broadcasted to both AMQP and 0MQ subscribers:

This diagram shows how message from 0MQ publisher is broadcasted to both AMQP and 0MQ subscribers: