Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Overview of the ServiceMix 2.x JMS Binding Example

This document The following procedure describes how to run the JMS Binding example and provides details about regarding what it does. For information on the business use case, please refer to: Use Case for JMS Binding.

The JMS Binding example illustrates the following:

  • use of declarative programming
  • how to perform JMS integration in ServiceMix
  • how to use an ActiveMQ message broker
  • how to use the Jencks JCA container
  • how to use the Geronimo Transaction Manager via the Jencks factory bean

...

  1. From a command shell, go to the JMS Binding example directory:
    Code Block
    cd [servicemix_install_dir]\examples\jms-binding
    
    where servicemix_install_dir is the directory in which ServiceMix was installed.
  2. Then type:
    Code Block
    [servicemix_install_dir]\bin\servicemix servicemix.xml
    
  3. To start the sending and receiving of message messages from the JMS topics, send it a JMS an initial message. To do this, compile and run a simple JMS client. The client is built and run from source code using Ant. Execute Ant from the JMS Binding directory: servicemix_install_dir\examples\jms-binding. To run the JMS client type:
    Code Block
    ant
    

    Ant will compile and run the simple JMS client, JMSClient, which performs a JMS based request-response into the ServiceMix container before returning the results to the console.

...

To terminate the JMS Binding example, type "CTRL-C" in the command shell in which it is running and answer "y" to the "Terminate batch job (y/n)?" question.

...

The diagram below illustrates the flow of messages through the JMS Binding components. :

Panel
borderColor#ccc
titleJMS Binding Example Message Flow Diagram
borderStylesolid

...

Component or Bean ID

Description

jbi

jbi is the "id" of the JBI container and provides the basic infrastructure services for the following components: inputReceiver and outputSender. During initialization, several singletons are instantiated: transactionManager, broker, jencks, jmsFactory, and jbi. After initialization, the components in the jbi container are activated.

inputReceiver

This component uses jencks , the JCA container, to listen on port 61616 for a JMS message on the topic called "demo.org.servicemix.source." inputReceiver subscribes to the demo.org.servicemix.source topic. It takes the message, normalizes it, and routes it to outputSender via the NMR. This component combined with outputSender and supporting beans creates a JMS bridge between two topics.

outputSender

This component receives a normalized message from the NMR, marshals it into a JMS message using jmsTemplate (1), then publishes it on the ActiveMQ (JMS) topic called "demo.org.servicemix.result."

jencks

The jencks bean defines a JCA container. The JCA container allows you to configure thread pool size, configure a transaction manager, and configure a resource adapter. In this example, the resource adapter is an ActiveMQ adapter, however, another any JMS listener could be configured instead. This adapter listens on port 61616 for JMS messages.

broker

The broker bean uses the activemq.xml file to configure the message broker, which handles the JMS messages for the components that require JMS messaging services.

transactionManager

This bean is configured to be the default transaction manager for the jbi container. jencks is configured to use the default transaction manager. This transaction manager provides transactional services between the resource adapter (in this case the ActiveMQ resource adapter provided by the jencks JCA container) and components the jbi container.

jmsFactory

This bean listens on port 61616 and provides a pooled ActiveMQ connection.

...