Due to asynchronous nature of AMQP 0-8/0-9/0-9-1 protocols sending a message with a routing key for which no queue binding exist results in either message being bounced back (if it is mandatory or immediate) or discarded on broker side otherwise.
When a 'mandatory' message is returned, the Apache Qpid JMS AMQP 0-x clients conveys this by delivering an AMQNoRouteException through the configured ExceptionListener on the Connection. This does not cause channel or connection closure, however it requires a special exception handling on client side in order to deal with AMQNoRouteExceptions. This could potentially be a problem when using various messaging frameworks (e.g. Mule) as they usually close the connection on receiving any JMSException.
In order to simplify application handling of scenarios where 'mandatory' messages are being sent to queues which do not actually exist, the Apache Qpid Broker-J can be configured such that it will respond to this situation by closing the connection rather than returning the unroutable message to the client as it normally should. From the application perspective, this will result in failure of synchronous operations in progress such as a session commit() call.
This feature affects only transacted sessions.
By default, the Apache Qpid JMS AMQP 0-x produces mandatory messages when using queue destinations. Topic destinations produce 'non-mandatory' messages.
The Port attribute closeWhenNoRoute can be set to specify this feature on broker side. By default, it is turned on. Setting closeWhenNoRoute to false switches it off.
See the Qpid JMS AMQP 0-x client documentation for details of enabling this feature client side.
Apache Qpid, Messaging built on AMQP; Copyright © 2015 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