LibraryLink ToToggle FramesPrintFeedback

Using a Custom Destination Resolver

Destination resolvers are a part of the JMS technology Fuse ESB inherits from the Spring Framework. They convert string destination names into JMS Destination objects. For example, if you specify an endpoint's destination using the destinationName attribute, the endpoint will use a destination resolver to get the appropriate JMS Destination object. Destination resolvers are also used if a destination chooser returns a string and not a JMS Destination object.

Fuse ESB JMS endpoints default to using the DynamicDestinationResolver destination resolver provided by the Spring Framework. This destination resolver uses the standard JMS Session.createTopic() and Session.createQueue() methods to resolve destination names.

Fuse ESB JMS endpoints can also use the Spring Framework's JndiDestinationResolver destination resolver. This destination resolver uses the string destination name to perform a JNDI lookup for the JMS destination. If JMS destination is not returned from the JNDI lookup, the resolver resorts to dynamically resolving the destination name. For information on configuring and endpoint to use the JndiDestinationResolver destination resolver. See Configuring an endpoint to use a destination resolver.

Destination resolvers implement the interface. The interface has a single method: resolveDestinationName().

The resolveDestinationName() method, whose signature shown in Example 7.5, takes three parameters: a JMS session, a destination name, and a boolean specifying if the destination is a JMS topic.[1] It returns a JMS destination that correlates to the provided destination name.

Example 7.6 shows a simple destination resolver implementation.

You can configure an endpoint to use a custom destination resolver in one of two ways. The recommended way is to configure the destination resolver as a bean and have the endpoint reference the destination resolver's bean. The other way is to explicitly include the destination resolver's configuration as a child of the endpoint.

As shown in Example 7.7, configuring an endpoint's destination resolver using a bean reference is a two step process:

  1. Configure a bean element for your destination resolver.

  2. Add a destinationResolver attribute that references the destination resolver's bean to your endpoint.

Example 7.8 shows an example configuration using the jms:destinationResolver element. This method is less flexible than the recommended method because other endpoints cannot reuse the destination resolver's configuration.

[1] If the value is false, a JMS queue will be returned.