LibraryToggle FramesPrintFeedback

Basic Configuration

Procedure

To configure a generic consumer or a SOAP consumer do the following:

  1. Decide what type of consumer endpoint to use.

    See Types of consumer endpoints.

  2. Specify the name of the service for which this endpoint is acting as a proxy.

    This is specified using the service attribute.

    [Tip]Tip

    If you are using a SOAP consumer and your WSDL file only has one service defined, you do not need to specify the service name.

  3. Specify the name of the endpoint for which this endpoint is acting as a proxy.

    This is specified using the endpoint attribute.

    [Tip]Tip

    If you are using a SOAP consumer and your WSDL file only has one endpoint defined, you do not need to specify the endpoint name.

  4. Specify the connection factory the endpoint will use.

    The endpoint's connection factory is configured using the endpoint's connectionFactory attribute. The connectionFactory attribute's value is a reference to the bean that configures the connection factory. For example, if the connection factory configuration bean is named widgetConnectionFactory, the value of the connectionFactory attribute would be #widgetConnectionFactory.

    For information on configuring a connection factory see Configuring the Connection Factory.

  5. Specify the destination onto which the endpoint will place messages.

    For more information see Configuring a destination.

  6. Specify the ESB endpoint to which incoming messages are targeted.

    For more information see Specifying the target endpoint.

  7. If you are using a JMS SOAP consumer, specify the location of the WSDL defining the message exchange using the wsdl attribute.

  8. If your JMS destination is a topic, set the pubSubDomaim attribute to true.

  9. If your endpoint is interacting with a broker that only supports JMS 1.0.2, set the jms102 attribute to true.

Configuring a destination

A consumer endpoint chooses the destination to use for sending messages with the following algorithm:

  1. 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:destination child element. You can also configure the bean separately and refer the bean using the endpoint's destination attribute as shown in Example 11.

    Example 11. Configuring a Consumer's Destination

    <beans xmlns:jms="http://servicemix.apache.org/jms/1.0"
           ... >
      ...
      <jms:consumer service="my:widgetService"
                     endpoint="jbiWidget"
                     destination="#widgetQueue"
                     ... />
      ...
      <jee:jndi-lookup id="widgetQueue" jndi-name="my.widget.queue">
        <jee:environment>
          java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
          java.naming.provider.url=t3://localhost:7001
        </jee:environment>
      </jee:jndi-lookup>
      ...
    </beans>

  2. If you did not explicitly configure a destination, the endpoint will use the value of the destinationName attribute to choose its destination.

    The value of the destinationName attribute is a string that will be used as the name for the JMS destination. The binding component's default behavior when you provide a destination name is to resolve the destination using the standard JMS Session.createTopic() and Session.createQueue() methods.

    [Note]Note

    You can override the binding component's default behavior by providing a custom DestinationResolver implementation. See Using a Custom Destination Resolver.

Specifying the target endpoint

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:

  1. If you explicitly specify an endpoint using both the targetService attribute and the targetEndpoint attribute, the ESB will use that endpoint.

    The targetService attribute specifies the QName of a service deployed into the ESB. The targetEndpoint attribute specifies the name of an endpoint deployed by the service specified by the targetService attribute.

  2. If you only specify a value for the targetService attribute, the ESB will attempt to find an appropriate endpoint on the specified service.

  3. 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 targetInterface attribute. 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 the name attribute of either a WSDL 1.1 serviceType element or a WSDL 2.0 interface element.

[Important]Important

If you specify values for more than one of the target attributes, the consumer endpoint will use the most specific information.

Examples

Example 12 shows the basic configuration for a plain JMS provider endpoint.

Example 12. Basic Configuration for a Generic Consumer Endpoint

<beans xmlns:jms="http://servicemix.apache.org/jms/1.0"
       ... >
  ...
  <jms:consumer service="my:widgetService"
                endpoint="jbiWidget"
                destinationName="widgetQueue"
                connectionFactory="#connectionFactory"
                targetService="my:targetService" />
  ...
</beans>

Example 13 shows the basic configuration for a SOAP JMS provider endpoint.

Example 13. Basic Configuration for a SOAP Consumer Endpoint

<beans xmlns:jms="http://servicemix.apache.org/jms/1.0"
       ... >
  ...
  <jms:soap-consumer wsdl="classpath:widgets.wsdl"
                     destinationName="widgetQueue"
                     connectionFactory="#connectionFactory"
                     targetService="my:targetService" />
  ...
</beans>

Comments powered by Disqus