WebORB includes integration with the RabbitMQ messaging broker. A messaging destination can be configured to relay messages to a RabbitMQ broker. WebORB sends messages published by the supported client environments to a RabbitMQ exchange or queue. Likewise, subscribers to a WebORB destination linked to RabbitMQ receive messages from the corresponding exchange or queue.
Below is a sample destination included with WebORB when the RabbitMQ integration is selected in the product installer:
<destination id="RabbitMQPollingDestination">
<properties>
<server>
<durable>false</durable>
</server>
<rabbitmq>
<!-- can be replaced with single <uri> tag. Read http://www.rabbitmq.com/uri-spec.html for more info. -->
<!-- If non of uri or other specified then default is used: amqp://guest:guest@localhost:5672/%2f -->
<uri>amqp://guest:guest@localhost:5672/%2f</uri>
<!-- An alternative to the <url> element, connection properties can be set using the elements below: -->
<!--
<host>localhost</host>
<port>5672</port>
<vhost>/</vhost>
<user>guest</user>
<password>guest</password>
-->
<!-- optional, default 'true' -->
<auto-ack>false</auto-ack>
<!-- optional, default 'false', ignored if autoAck = true -->
<requeue>true</requeue>
<!-- message priority. Accepted values are 0 to 9, optional -->
<message-priority>6</message-priority>
<!-- NON_PERSISTENT (default) or PERSISTENT -->
<delivery-mode>NON_PERSISTENT</delivery-mode>
<!-- Should implement weborb.util.io.ISerializer -->
<serializer>weborb.util.io.Serializer</serializer>
<!-- Should implement weborb.messaging.v3.amqp.rabbitmq.IMessageFactory -->
<message-factory>weborb.messaging.v3.amqp.rabbitmq.DefaultMessageFactory</message-factory>
<exchange>
<name>topic1</name>
<exchange-type>topic</exchange-type> <!-- default 'topic'-->
<!--routing-key></routing-key--> <!-- optional-->
</exchange>
<!-- name of the queue to bind the exchange to (optional) -->
<queue>
<name>simpleQueue</name>
</queue>
</rabbitmq>
<message-service-handler>weborb.messaging.v3.amqp.rabbitmq.RabbitMQServiceHandler</message-service-handler>
</properties>
<channels>
<!-- for RTMP change channel ref to "weborb-rtmp-messaging" -->
<channel ref="my-polling-amf"/>
</channels>
</destination>
Destination's configuration should include either <exchange> or <queue> elements or both. As a result, the integration supports the following configurations:
| 1. | Server-named queue per subscriber If the destination's configuration omits the <queue> element and only declares <exchange>, WebORB allocates a new server-named RabbitMQ queue for each new subscriber. The queue is created using the channel.queueDeclare() method and bound to the specified exchange. This configuration supports multiple subscribers and multiple publishers for the same destination. |
| 2. | Single queue with the default exchange If the destination's configuration includes only the <queue> element and does not specify the <exchange> element, the destination is bound to the queue. In this case, there may be multiple publishers, but only one subscriber. WebORB routes messages published to the destination using the default exchange and the queue name as the routing key. |
| 3. | Single queue with the specific exchange This is the scenario when both <queue> and <exchange> elements are present in the destination's configuration. This is identical to the scenario described above exception a specific exchange is used instead of the default one. The scenario supports multiple publishers and a single subscriber. |