Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
where {{servicemix_install_dir}} is the directory in which Service Mix was installed.
\\
\\
h3. Stopping the _Basic_ Example
To terminate the Basic example type "CTRL-C" in the command shell in which it is running.
\\
\\

h3. How it Works
The diagram illustrates the components of the Basic example and how they interact with each other within the JBI container.
\\
\\

{panel:title= Basic Example Flow Diagram|borderStyle=solid|borderColor=#ccc}
!basicflow.jpg|align=center!
{panel}

\\
\\

The flow of the program is:
# The _timer_ component sends a Normalized Message (NM) to _inputSender_.
# _inputSender_ converts the message (marshals it) into a JMS message and publishes it to the JMS topic called "demo.org.servicemix.source."
# _jencks_ listens on port 61616 for messages
# _inputReceiver_ subscribes to the "demo.org.servicemix.source" topic via the _jencks_ bean and receives the JMS message.
# _inputReceiver_ normalizes the JMS message and sends it to _outputSender_ via the Normalized Message Router (NMR).
# _outputSender_ marshals the NM to a JMS message and publishes it on the "demo.org.servicemix.result" topic.
# _jmsTrace_, via _jencks_, subscribes to the "demo.org.servicemix.result" topic and receives the JMS message.
# _jmsTrace_ converts the JMS message into a normalized message and sends it to _trace_ via the NMR.
# _trace_ logs the message to a log file.
\\
\\

The following table explains the function of each component and bean in the servicemix.xml file.
||Component or Bean ID||Description||
|_jbi_|The _jbi_ container contains the following components: _timer_, _inputSender_, _inputReceiver_, _outputSender_, _jmsTrace_, and _trace_. First the servicemix.xml file initializes the _jbi_ container by setting several properties. Then the components are run. Note: During the initialization, a bean called "transactionManager" is instantiated. The _transactionManager_ provides the connectivity between the JMS messaging system and the _jbi_ container. |
|_timer_|Every 5 seconds, until the program is terminated, the timer component kicks off a trigger. The job has a property called "name" with a value of "My Example Job" and another property called "group" with a value of "ServiceMix." The trigger is converted to a normalized message and routed through the Normalized Message Router (NMR).|
|_inputSender_|Receives the normalized message (the trigger), converts it to a JMS message, and publishes it to the topic called demo.org.servicemix.source.|
|_inputReceiver_|This component uses the bean called _jencks_ , which is a JCA container, to listen on port 61616 for a JMS message on the topic called "demo.org.servicemix.source." Essentially, _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 some 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_, then publishes it on the ActiveMQ (JMS) topic called "demo.org.servicemix.result."| 
|_jmsTrace_|This component uses the _jencks_ bean to subscribe to the "demo.org.servicemix.result" topic and get the message that is there. It then marshals the message into a Normalized Message and routes it via the NMR to the _trace_ component.|
|_jmsTrace_|This component uses _jencks_ to listen to port 61616 for the purposes of tracing the messages received on that port.|
|_trace_| |
| | |
| | |
|_jencks_| The _jencks_ bean defines a JCA container.  This bean has two properties, one of which is an ActiveMQ listener, which listens on port 61616. In general a JCA container must provide threading, The JCA |
|_broker_|The _broker_ bean ...|
|_transactionManager_|This bean is invoked in the _jbi_ containers initialization. It instantiates the
org.jencks.factory.TransactionManagerFactoryBean. This bean provides XA transactions between the resource adapter (in this case the ActiveMQ resource adapter) and the _jbi_ container. |
|_jmsFactory_|This bean listens on port 61616.|


When running the _Basic_ example, the typical output looks like the following. Every 5 seconds logging information is written to the console, followed by information from the trace component. Note, that the triggers' property values of "name", "My Example Job", "group", and "ServiceMix" are displayed along with a timestamp.

...