A queue can be bound to an exchange in virtual host configuration file by providing an exchange name in element exchange within the queue configuration element having the same name as a queue. If exchange element is omitted in queue configuration then such queue is bound to a default exchange only. With configuration file it is only possible to bind queue to a single exchange.
An element routingKey is used to specify a custom binding key. It is an optional element, and, if it is not set then queue is bound to an exchange with a binding key equals to a queue name. Any number of binding keys can be configured.
Binding arguments can be set with each binding key. An element bindingArgument is used to specify a binding argument as a name-value pair separated with equal character. Any number of binding arguments can be provided for a binding key in their own bindingArgument elements. All of them should be contained within an element having the same name as a binding key.
The following example demonstrates how to bind queue testQueue to a default topic exchange using routing key testRoutingKey and binding arguments for message selector and no local.
Example 14.14. Queue Binding Example
<queue> <name>testQueue</name> <testQueue> <exchange>amq.topic</exchange> <routingKey>testRoutingKey</routingKey> <testRoutingKey> <bindingArgument>x-filter-jms-selector=application='app1'</bindingArgument> <bindingArgument>x-qpid-no-local=</bindingArgument> </testRoutingKey> </testQueue> </queue>
Apache Qpid, Messaging built on AMQP; Copyright © 2013 The Apache Software Foundation; Licensed under the Apache License, Version 2.0; Apache Qpid, Qpid, Qpid Proton, Proton, Apache, the Apache feather logo, and the Apache Qpid project logo are trademarks of The Apache Software Foundation; All other marks mentioned may be trademarks or registered trademarks of their respective owners