Versions Compared

Key

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

...

The File Binding servicemix.xml contains two components and a supporting bean. One component retrieves files from a source inbox directory, then routes the file over the Normalized Message Router (NMR) to another compoonent component which deposits the file into a destination an outbox directory in the file system.



Running the

...

From a command shell, go to the File Binding example directory:

...

File Binding Example

To run the example, copy the test-file.xml to the inbox directory:
(code)
cd servicemix_install_dir\examples\file-binding
copy test-file.xml inbox

Code Block


From a command shell, go to the File Binding example directory:

cd servicemix_install_dir

...

\examples\file-binding

[
Code Block
Then type:
Code Block

servicemix_install_dir

...

\bin\servicemix

...

servicemix.xml

Code Block
where {{servicemix_install_dir}} is the directory in which Service Mix was installed.

...

Stopping the Basic Example

...


\\

h3. 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 Removed

Messages flow through the components as follows:

...


\\


h3. 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:title= Basic Example Message Flow Diagram|borderStyle=solid|borderColor=#ccc}
!basicflow1.jpg|align=center!
{panel}

\\
\\

Messages flow through the components as follows:
# The _timer_ component sends a normalized message to _inputSender_ through the Normalized Message Router (NMR).
# _inputSender_ converts the message (marshals it) into a JMS message, then uses the _jmsTemplate_ bean to publish the message. 
# _jmsTemplate_ uses the _jmsFactory_ bean to get a connection to the port associated with the JMS topic called "demo.org.servicemix.source." The message is published on the "demo.org.servicemix.source" topic.

...


# _jencks_ (the JCA resource adapter) listens on port 61616 for messages.

...


# _inputReceiver_ subscribes to the "demo.org.servicemix.source" topic via _jencks_ and receives the JMS message.

...


# _inputReceiver_ normalizes the JMS message and sends it to _outputSender_ via the NMR.
# _outputSender_ marshals the normalized message to a JMS message and uses _jmsTemplate_ to publish the message on the "demo.org.servicemix.result" topic.

...


# _jmsTemplate_ publishes it on the "demo.org.servicemix.result" topic using _jmsFactory_ to get a connection to the result topic.

...


# _jencks_ listens on port 61616 for messages.
# _jmsTrace_ subscribes to the "demo.org.servicemix.result" topic and receives the JMS message via _jencks_.

...

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:

...


# _jmsTrace_ converts the JMS message into a normalized message and sends it to _trace_ via the NMR.
# _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: 
\\

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 Block

Details

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

...