Fuse ESB JMS consumers determine destination of reply messages and exceptions uses a straightforward algorithm. By default, the reply destination is supplied by the message that started the exchange. If the reply destination cannot be determined from the request message, the endpoint will use a number of strategies to determine the reply destination.
You can customize how the endpoint determines the reply destination using the endpoint's configuration. You can also supply fall back values for the endpoint to use.
Consumer endpoints use the following algorithm to determine the reply destination for a message exchange:
If the in message of the exchange includes a value for the JMSReplyTo property, that value is used as the reply destination.
If the JMSReplyTo is not specified, the endpoint looks for a destination chooser implementation to use.
If you have configured your endpoint with a destination chooser, the endpoint will use the destination chooser to select the reply destination.
For more information on using destination choosers see Using a Custom Destination Chooser.
If the JMSReplyTo is not specified and there is no configured destination chooser, the endpoint checks its
replyDestination
attribute for a destination.You configure a destination using a Spring bean. The recommend method to configure the destination is to configure the bean separately and refer the bean using the endpoint's
replyDestination
attribute as shown in Example 3.11. You can also add the bean directly to the endpoint by wrapping it in ajms:replyDestination
child element.As a last resort, the endpoint will use the value of the
replyDestinationName
attribute to determine the reply destination.The
replyDestinationName
attribute takes a string that is used as the name of the destination to use. The binding component's default behavior when you provide a destination name is to resolve the destination using the standard JMSSession.createTopic()
andSession.createTopic()
methods to resolve the JMS destination.Note You can override the binding component's default behavior by providing a custom
DestinationResolver
implementation. See Using a Custom Destination Resolver.
Example 3.11 shows an example of configuring a consumer endpoint to use a dedicated JMS destination.
Example 3.11. Configuring a Consumer's Reply Destination
<beans xmlns:jms="http://servicemix.apache.org/jms/1.0" ... > ... <jms:consumer service="my:widgetService" endpoint="jbiWidget" destinationName="my.widgetQueue" connectionFactory="#connectionFactory" replyDestination="#widgetReplyQueue" /> ... <jee:jndi-lookup id="widgetReplyQueue" jndi-name="my.widget.reply.queue"> <jee:environment> java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory java.naming.provider.url=t3://localhost:7001 </jee:environment> </jee:jndi-lookup> ... </beans>