Versions Compared

Key

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

...

To run the example, copy the test-file.xml to the inbox directory: (

Code Block

...


cd [servicemix_install_dir]\examples\file-binding

...


copy test-file.xml inbox

...

code



From

...

a

...

command

...

shell,

...

go

...

to

...

the

...

File

...

Binding

...

example

...

directory:

Code Block
cd [servicemix_install_dir]\examples\file-binding

...

code


Then

...

type:

Code Block
[servicemix_install_dir]\bin\servicemix servicemix.xml

...

code


where

...

servicemix_install_dir

...

is

...

the

...

directory

...

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

...


and

...

answer

...

"y"

...

to

...

the

...

"Terminate

...

batch

...

job

...

(y/n)?"

...

question.

...


How it Works

The diagram below illustrates the flow of messages through the Basic components.

There are two components and a referenced bean (used by one of the components) in the servicemix.xml file:

  • filePoller - periodically checks the "inbox" directory for new files. If there is a file present, it transports the file over the Normalized Message Router (NMR) to the fileSender component. It will also recursively scan subdirectories for files.
  • fileSender -
  • workManager -



Panel
borderColor#ccc
titleBasic Example Message Flow Diagram
borderStylesolid

Image Added



Messages flow through the components as follows:

  1. The timer component sends a normalized message to inputSender through the Normalized Message Router (NMR).
  2. inputSender converts the message (marshals it) into a JMS message, then uses the jmsTemplate bean to publish the message.
  3. jmsTemplate uses the jmsFactory bean to get a connection to the port associated with the JMS topic called "demo.org.servicemix.source."

...

  1. The

...

  1. message

...

  1. is

...

  1. published

...

  1. on

...

  1. the

...

  1. "demo.org.servicemix.source"

...

  1. topic.

...

  1. jencks (the

...

  1. JCA

...

  1. resource

...

  1. adapter)

...

  1. listens

...

  1. on

...

  1. port

...

  1. 61616

...

  1. for

...

  1. messages.

...

  1. inputReceiver subscribes to the "demo.org.servicemix.source"

...

  1. topic

...

  1. via

...

  1. jencks

...

  1. and

...

  1. receives

...

  1. the

...

  1. JMS

...

  1. message.

...

  1. inputReceiver normalizes the JMS message and sends it to outputSender via the NMR.
  2. outputSender marshals the normalized message to a JMS message and uses jmsTemplate to publish the message on the "demo.org.servicemix.result"

...

  1. topic.

...

  1. jmsTemplate publishes it on the "demo.org.servicemix.result"

...

  1. topic

...

  1. using

...

  1. jmsFactory

...

  1. to

...

  1. get

...

  1. a

...

  1. connection

...

  1. to

...

  1. the

...

  1. result

...

  1. topic.

...

  1. jencks listens on port 61616 for messages.
  2. jmsTrace subscribes to the "demo.org.servicemix.result"

...

  1. topic

...

  1. and

...

  1. receives

...

  1. the

...

  1. JMS

...

  1. message

...

  1. via

...

  1. jencks

...

  1. .

...

  1. jmsTrace converts the JMS message into a normalized message and sends it to trace via the NMR.
  2. trace transforms the normalized message into a string and logs it to the console.

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. Typical output looks like the following:

Code Block

 
 
[INFO] TraceComponent - -Exchange: org.servicemix.jbi.messaging.InOnlyImpl@4fdf11 received IN message:

...

 
org.servicemix.jbi.messaging.NormalizedMessageImpl@1be0369{properties: {org.servicemix.jms.message=ACTIVEMQ_TEXT_MESSAGE:

...

 
id = 0 ActiveMQMessage{ , jmsMessageID = null, bodyAsBytes = org.activemq.io.util.ByteArray@1d1fc02,

...

 
readOnlyMessage = true, jmsClientID = 'ID:Lisas-2828-1126207917359-23:0' ,

...


 jmsCorrelationID = 'null' , jmsDestination = demo.org.servicemix.result, jmsReplyTo = null, jmsDeliveryMode = 2,

...

 
 jmsRedelivered = false, jmsType = 'null' , jmsExpiration = 0, jmsPriority = 4, jmsTime

...


stamp = 1126207938593, properties = {}, readOnlyProperties = true, entryBrokerName = 'ID:Lisas-2828-1126207917359-0:0' ,

...

 
entryClusterName = 'default' , consumerNos = [0], transactionId = 'null' , xaTransacted = false,

...

 
consumerIdentifer = 'ID:Lisas-2828-1126207917359-14:0' , messageConsumed = false, transientConsumed = true,

...

 
sequenceNumber = 7, deliveryCount = 1, dispatchedFromDLQ = false, messageAcknowledge = org.activemq.ActiveMQSession@1de7497,

...


jmsMessageIdentity = null, producerKey = ID:Lisas-2828-1126207917359-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>

...


Thu Sep 08 12:32:18 PDT 2005</fireTime></timer>}}

...

code


Details

The following table provides more details about the function of each component and bean in the servicemix.xml file.

...