Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.Questo contenuto non è disponibile nella lingua selezionata.
Chapter 19. Implementing Destination Resolving Logic
Abstract
DestinationChooser
interface or the DestinationResolver
interface.
- destination choosers
- Destination choosers are specific to the Red Hat JBoss Fuse JMS binding component. They are the first mechanism used by an endpoint when it trys to pick a JMS destination.Destination choosers implement the
org.apache.servicemix.jms.endpoints.DestinationChooser
interface. - destination resolvers
- Destination resolvers are part of the Spring JMS framework. They are used when the JMS destination is specified using a string. This can happen if either the destination chooser returns a string or if the endpoint's destination is configured using the
destinationName
attribute.Destination resolvers implement theorg.springframework.jms.support.destination.DestinationResolver
interface.
19.1. Using a Custom Destination Chooser Copia collegamentoCollegamento copiato negli appunti!
Overview Copia collegamentoCollegamento copiato negli appunti!
org.apache.servicemix.jms.endpoints.DestinationChooser
interface and configure the endpoint to load it. The configured destination chooser will be used in place of the default destination chooser.
Implementing a destination chooser Copia collegamentoCollegamento copiato negli appunti!
org.apache.servicemix.jms.endpoints.DestinationChooser
interface. This interface has a single method: chooseDestination()
.
chooseDestination()
, whose signature is shown in Example 19.1, “Destination Chooser Method”, takes the JBI message exchange and a copy of the message. It returns either a JMS Destination
object or a string representing the destination name.
Example 19.1. Destination Chooser Method
Object chooseDestination(MessageExchange exchange,
Object message);
message
parameter can be either of the following type of object:
javax.jbi.messaging.NormalizedMessage
javax.jbi.messaging.Fault
Exception
Example 19.2. Simple Destination Chooser
Configuring an endpoint to use a destination chooser Copia collegamentoCollegamento copiato negli appunti!
- Configure a
bean
element for your destination chooser. - Add a
destinationChooser
attribute that references the destination chooser's bean to your endpoint.
Example 19.3. Configuring a Destination Chooser with a Bean Reference
jms:destinationChooser
element. This method is less flexible than the recommended method because other endpoints cannot reuse the destination chooser's configuration.
Example 19.4. Explicitly Configuring a Destination Chooser