Router Message: Apache Camel & Service Mix

Apache ServiceMix is a flexible, a powerful runtime platform for integrations solutions.
The tutorial will introduce you how to use Service Mix with Apache Camel & ActiveMQ for routing message solution

Related Article: How to start Apache Camel: Message Router with Spring Boot

I. Technologies for Routing message with ServiceMix tutorial

– Java 1.8
– Maven 3.3.9
– Spring Tool Suite – Version 3.8.1.RELEASE
– Apache Servicemix: 7.0.0.M2

II. Overview
1. Step to do

– Download Apache ServiceMix
– Create a Camel Router
– Start ServiceMix, install ActiveMQ and Camel Router
– Routing Result

2. Demo Video
III. Practices
1. Download Apache ServiceMix

Go to servicemix.apache.org, download: ServiceMix 7.0.0.M2

2. Create a Camel Router

Use Blueprint for make a Camel Router file: camel.xml. It has 2 part:
– Create a ActiveMQComponent bean for connection factory.
– Create a camelContext for routing.
Scenario:
Send a message to IN queue of ActiveMQ, if message contains o1, it will be routed to OUT_1 queue. If message contains o2, it will be routed to OUT_2 queue. Otherwise, it will be routed to OUT_3

Details:

3. Start ServiceMix, install ActiveMQ and Camel Router

– Start ServiceMix: extract downloaded file, go to apache-servicemix-7.0.0.M2\bin, use cmd to start .bat file: servicemix.bat

start service mix

– Install ActiveMQ by command: karaf@root> features:install activemq-broker
– Deploy Camel Router: place camel.xml at apache-servicemix-7.0.0.M2\deploy folder

See the deployment (Activemq & Camel)successfully with command: bundle:list

activemq and camel deploy successful on service mix

4. Routing Result

Go to ActiveMQ broker webconsole: http://localhost:8181/activemqweb/queues.jsp

– Send a message: o1: Hello World!

send o1 HelloWorld! message to Active MQ

Result:

send o1 HelloWorld! message to Active MQ - result

– Send a message: o2: Welcome to Service Mix & Camel! :

send o2 Welcome to Service Mix & Camel!

Result:

send o2 Welcome to Service Mix & Camel! - result

– Send a message Nice day!

Send Nice day! - result

Result:

Send Nice day!

IV. Source code

Apache Camel


Related Posts


1 thought on “Router Message: Apache Camel & Service Mix”

  1. Thanx so much… Can you please post how to Establish ftp connection using service mix(How to transfer files from local file system to file server )

Got Something To Say:

Your email address will not be published. Required fields are marked *

*