Overview of the ServiceMix
...
Basic Example
This document describes how to run the Basic example and provides details about what it does. For information on the business use case, please refer to: Use Case for Basic.
The Basic example illustrates the following:
...
The source code for the Basic example is located in the ServiceMix installation directory under the examples\basic
directory in the servicemix.xml
file. It is recommended that you refer to the source code while reading this document.
There are several components in the servicemix.xml
file. One component sets off a trigger to send messages to a source destination. Then those messages are consumed by another component and sent to a different output destination. A trace component displays the messages as they arrive.
Running the Basic Example
From a command shell, go to the Basic example directory:
Code Block |
---|
cd [servicemix_install_dir]\examples\basic |
Tip | ||
---|---|---|
| ||
Note: if you are running version 3.0-M2 and experience an error like |
Then type:
Code Block |
---|
[servicemix_install_dir]\bin\servicemix servicemix.xml |
where servicemix_install_dir
is the directory in which ServiceMix was installed.
Tip | ||
---|---|---|
| ||
Add $SERVICEMIX_HOME\bin directory to $PATH variable to simplify execution of the example. |
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.
Panel | ||||||
---|---|---|---|---|---|---|
| ||||||
|
Messages flow through the components as follows:
...
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>}} |
Details
The following table provides more details about the function of each component and bean in the servicemix.xml file.
...
1. jmsTemplate: JmsTemplate is a Spring component which hides the low level details when sending JMS messages. For additional information see: JmsTemplate. jmsTemplate is not a component in the jbi container. It is used by inputSender and outputSender.
Issues
The ServiceMix 2.0.2 distribution has a known logging bug, so output is not logged to the console. This can be corrected in the sourcedistribution of ServiceMix 2.0.2, by replacing the jencks-all-1.1.1.jar with the jencks-all-1.1.2.jar file. Upgrading to 2.0.3 will also resolve the problem. 2.0.3 release is a developer's release at this time. Please see Download for the latest developer's release.
...
- Download the jencks-all-1.2.jar here.
Copy the jar file to \ [servicemix_src_install_dir\]\assembly\target\servicemix-2.0.2\bin\servicemix-2.0.2\lib, where \ [servicemix_src_install_dir\] is the directory in which the ServiceMix distribution is located.Wiki Markup - Delete jencks-all-1.1.1.jar from that directory.
Place a copy of the jar file in the ServiceMix web directory at \ [servicemix_src_install_dir\]\servicemix-2.0.2\tooling\servicemix-web\target\servicemix-web\WEB-INF as well.Wiki Markup - To run the example in the source distribution:
Code Block cd [servicemix_src_install_dir]\assembly\target\servicemix-2.0.2\bin\servicemix-2.0.2\bin ..\..\bin\servicemix servicemix.xml
- test
Note: It is not necessary to build the source distribution if you have previously done so. If ServiceMix has not been built, execute the above steps before building. The procedure on how to build the source distribution can be found here.
Related Documentation
For more information on the following topics please see:
...