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. ??????
\\
\\

h3. Details

The following table provides more details about 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 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.
\\

INFO TraceComponent - -Exchange: org.servicemix.jbi.messaging.InOnlyImpl@b55129 received IN message:
org.servicemix.jbi.messaging.NormalizedMessageImpl@8c9b49{properties: {org.servicemix.jms.message=ACTIVEMQ_TEXT_MESSAGE: id = 0 ActiveMQMessage
{ , jmsMessageID = ID:redmac-2.local-50615-1123857186823-29:1, bodyAsBytes = org.activemq.io.util.ByteArray@b1a22,
readOnlyMessage = true, jmsClientID = 'ID:redmac-2.local-50615-1123857186823-22:0' , jmsCorrelationID = 'null' ,
jmsDestination = demo.org.servicemix.result, jmsReplyTo = null, jmsDeliveryMode = 2, jmsRedelivered = false, jmsType = 'null'
, jmsExpiration = 0, jmsPriority = 4, jmsTimestamp = 1123857193312, properties = {}, readOnlyProperties = true, entryBrokerName =
'ID:redmac-2.local-50615-1123857186823-0:0' , entryClusterName = 'default' , consumerNos = 0, transactionId = 'null' ,
xaTransacted = false, consumerIdentifer = 'ID:redmac-2.local-50615-1123857186823-14:0' , messageConsumed = false,
transientConsumed = true, sequenceNumber = 1, deliveryCount = 1, dispatchedFromDLQ = false, messageAcknowledge =
org.activemq.ActiveMQSession@74b5ee, jmsMessageIdentity = null, producerKey = ID:redmac-2.local-50615-1123857186823-29: },
text = <?xml version="1.0" encoding="UTF-8"?><timer><name>My Example Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example Job
</fullname><description/><fireTime>Fri Aug 12 15:33:12 BST 2005</fireTime></timer>}}

Code Block

Details

The following table provides more details about 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.

INFO TraceComponent - -Exchange: org.servicemix.jbi.messaging.InOnlyImpl@b55129 received IN message:
org.servicemix.jbi.messaging.NormalizedMessageImpl@8c9b49{properties: {org.servicemix.jms.message=ACTIVEMQ_TEXT_MESSAGE: id = 0 ActiveMQMessage
{ , jmsMessageID = ID:redmac-2.local-50615-1123857186823-29:1, bodyAsBytes = org.activemq.io.util.ByteArray@b1a22,
readOnlyMessage = true, jmsClientID = 'ID:redmac-2.local-50615-1123857186823-22:0' , jmsCorrelationID = 'null' ,
jmsDestination = demo.org.servicemix.result, jmsReplyTo = null, jmsDeliveryMode = 2, jmsRedelivered = false, jmsType = 'null'
, jmsExpiration = 0, jmsPriority = 4, jmsTimestamp = 1123857193312, properties = {}, readOnlyProperties = true, entryBrokerName =
'ID:redmac-2.local-50615-1123857186823-0:0' , entryClusterName = 'default' , consumerNos = 0, transactionId = 'null' ,
xaTransacted = false, consumerIdentifer = 'ID:redmac-2.local-50615-1123857186823-14:0' , messageConsumed = false,
transientConsumed = true, sequenceNumber = 1, deliveryCount = 1, dispatchedFromDLQ = false, messageAcknowledge =
org.activemq.ActiveMQSession@74b5ee, jmsMessageIdentity = null, producerKey = ID:redmac-2.local-50615-1123857186823-29: },
text = <?xml version="1.0" encoding="UTF-8"?><timer><name>My Example Job</name><group>ServiceMix</group><fullname>ServiceMix.My Example Job
</fullname><description/><fireTime>Fri Aug 12 15:33:12 BST 2005</fireTime></timer>}}

...



Related Documentation

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