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.
15.3. Using the JCA Consumer Endpoint
Procedure Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
To configure a JCA consumer endpoint do the following:
- Specify the name of the service for which this endpoint is acting as a proxy.This is specified using the
serviceattribute. - Specify the name of the endpoint for which this endpoint is acting as a proxy.This is specified using the
endpointattribute. - Specify the connection factory the endpoint will use.The endpoint's connection factory is configured using the endpoint's
connectionFactoryattribute. TheconnectionFactoryattribute's value is a reference to the bean that configures the connection factory. For example if the connection factory configuration bean is namedwidgetConnectionFactory, the value of theconnectionFactoryattribute would be#widgetConnectionFactory.For information on configuring a connection factory see Chapter 14, Configuring the Connection Factory. - Specify the destination onto which the endpoint will place messages.For more information see the section called “Configuring a destination”.
- Configure the JCA resource adapter that the consumer will use.You configure the endpoint's resource adapter using the
resourceAdapterattribute. The attribute's value is a reference to the bean that configures the resource adapter. - Configure the
ActivationSpecobject that will be used by the endpoint.You configure the endpoint's resource adapter using theactivationSpecattribute. The attribute's value is a reference to the bean that configures theActivationSpecobject. - Specify the ESB endpoint to which incoming messages are targeted.For more information see the section called “Specifying the target endpoint”.
- If your JMS destination is a topic, set the
pubSubDomaimattribute totrue.
Configuring a destination Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
A consumer endpoint chooses the destination to use for sending messages with the following algorithm:
- The endpoint will check to see if you configured the destination explicitly.You configure a destination using a Spring bean. You can add the bean directly to the endpoint by wrapping it in a
jms:destinationchild element. You can also configure the bean separately and refer the bean using the endpoint'sdestinationattribute as shown in Example 15.9, “Configuring a JCA Consumer's Destination”.Example 15.9. Configuring a JCA Consumer's Destination
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - If you did not explicitly configure a destination, the endpoint will use the value of the
destinationNameattribute to choose its destination.The value of thedestinationNameattribute is a string that corresponds to the name of the JMS destination. The binding component's default behavior when you provide a destination name is to resolve the destination using the standard JMSSession.createTopic()andSession.createQueue()methods.NoteYou can override the binding component's default behavior by providing a customDestinationResolverimplementation. See Section 19.2, “Using a Custom Destination Resolver”.
Specifying the target endpoint Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
There are a number of attributes available for configuring the endpoint to which the generated messages are sent. The poller endpoint will determine the target endpoint in the following manner:
- If you explicitly specify an endpoint using both the
targetServiceattribute and thetargetEndpointattribute, the ESB will use that endpoint.ThetargetServiceattribute specifies the QName of a service deployed into the ESB. ThetargetEndpointattribute specifies the name of an endpoint deployed by the service specified by thetargetServiceattribute. - If you only specify a value for the
targetServiceattribute, the ESB will attempt to find an appropriate endpoint on the specified service. - If you do not specify a service name or an endpoint name, you must specify an the name of an interface that can accept the message using the
targetInterfaceattribute. The ESB will attempt to locate an endpoint that implements the specified interface and direct the messages to it.Interface names are specified as QNames. They correspond to the value of thenameattribute of either a WSDL 1.1serviceTypeelement or a WSDL 2.0interfaceelement.
Important
If you specify values for more than one of the target attributes, the consumer endpoint will use the most specific information.
Example Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
Example 15.10, “Basic Configuration for a JCA Consumer Endpoint” shows the configuration for a JCA consumer endpoint.
Example 15.10. Basic Configuration for a JCA Consumer Endpoint