You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

Overview of the Basic Example

This document describes how the Basic example is used and provides details about what it does.
The source code for the Basic example is stored in the Service Mix installation directory under the examples\basic directory in the servicemix.xml file.
The Basic example illustrates the following concepts:

  • use of declarative programming
  • how to use an ActiveMQ message broker
  • how to use a Quartz timer
  • how to use the jencks JCA container
  • how to use a transaction manager
  • how to using tracing

The example has several components. One component sets off a timer to send messages to a source destination. Then those messages are consumed by another component and sent to a different output destination - along with a trace component displaying the output messages as they arrive. This demonstrates a simple JMS bridge in action along with timers and tracing.

The diagram illustrates the components of the Basic example and how they interact with each other within the JBI container.

A DIAGRAM WILL BE PUT HERE--still creating

The following table explains the basic function of each component and bean in the servicemix.xml file.

Component or Bean ID

Description

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 ir via the NMR to the trace component.



Interesting Details

Perhaps I should have a section that might describe in more detail some important but subtle
aspect of the XML code. Will need input from developers. This section may not be applicable to
all examples.

Running the Basic Example

To run Basic:
From a command shell, go to the Basic example directory:

cd [servicemix_install_dir]\examples\basic

To run it:

[servicemix_install_dir]\bin\servicemix servicemix.xml

where servicemix_install_dir is the location in which Service Mix was installed.

Stopping the Basic Example

To terminate the Basic example type "CTRL-C" in the command shell in which it is running.

Related Documentation

Please see ..., plus Jira XX for details on fields...

  • No labels