6.2.4. Binding URLs

6.2.4. Binding URLs

In MRG Messaging JNDI properties, a Binding URL can specify the bindings that define the relationship between a queue and an exchange. For instance, the following Binding URL specifies a binding between a message queue named message_queue and the amq.direct exchange, using the routing key routing_key:

direct://amq.direct//message_queue?routingkey="routing_key"

The format for a Binding URL is:

[<Exchange Class>://<Exchange Name>/[<Queue>][?<option>='<value>'[&<option>='<value>']]

MRG Messaging supports the following properties in Binding URLs:

Option Type Description
durable boolean true if queue is durable, false if transient.
exclusive boolean true for a private queue, false for a shared queue.
autodelete boolean true if queue is automatically deleted when last subscription finishes.
routingkey string (see below) Value to use as the routing key for the destiniation.
bindingkey string (see below) One or more binding keys to be bound to the destination.
clientid string Client ID.
subscription boolean true if a subscription should be created for this queue, false otherwise.
Table 6.3. Binding URL Properties

A routing key is used when publishing, a binding key is used when binding a queue to an exchange. In JMS, a destination can play both roles, so the same destination can be used for both publishing and consuming. A given binding key may have only one routing key, but it may have multiple binding keys. For backwards compatibility, if no binding key is given and the destination is bound to an exchange, the routing key is used as a binding key.