Skip to main content

Red Hat JBoss Fuse - Sending message to queue in ActiveMQ via Camel

We will need to install 3 softwares before hand.

A. Fuse
B. FuseIDE
C. Maven

To get JBoss Fuse, logon to JBoss Customer Portal, download the beta version. Or Visit the .

Unzip the file to install JBoss Fuse. (A best practice for installing the software is not to have space or any special characters in the path)

open up file under $FUSE_INSTALLATION_PATH/etc
by taking out # before admin setting, we have create a user admin, with password admin that has the right of an administrator.

Fuse IDE is the development tool, it's very helpful, it has various examples for you to get started. So we download it from JBoss Customer Portal, or Visit the for it.  Depends on your own operating system, download the version that apply to you.

Install the IDE by choosing the installation path and basically just click next, next to complete the installation.

Another must have to do this demo is maven. I am sure almost everyone has it now. I will explain and show why we needed it later.

For this demo, there are 2 major step.

A.For the running environment, we are going to setup a Fabric management environment with JBoss Fuse. Create and start a ActiveMQ broker (Master-Slave), so we can put message into the queue using Camel. And create a container called "demo" for running the camel route.
B. Create a Camel Project. Within the project we are going to create 2 routes.
  1. Sends a message into a queue called "demo" every 5 secs.
  2. Listen on the demo queue, as soon as it receives message, print it out.

1.Go to $FUSE_INSTALLATION_PATH/bin,run ./fuse (For Windows run fuse.bat) After fuse got started, create a fabric management enviorment by type in the following command.

JBossFuse:karaf@root> fabric:create --zookeeper-password admin 

2. To access the new management console for JBoss Fuse 6.1 . Access http://localhost:8181 in your browser . Logon with admin/admin (ID/PWD)。

After logon, checkout the top right had corner, choose Fabric under Container.

3. Click MQ on the top menu, you will be able to see the embedded broker for this root container. But we are not going to use this one. What we are going to do is to setup a ActiveMQ Broker to handle the messaging.

Name the Broker : "demoBroker", choose MasterSlave as the backup strategy. And Click on the Create Broker. 

Since only the config of the broker has been created, you will see 0 and red show on the screen for our demoBroker. Click on the number "0" to create containers to run it.

Everything is very straight forward to create a container. Set container's name and because we choose MasterSlave that has minimum number of 2 instance, therefore we will create 2 containers here.

2 containers are created. 

To view the detail of each container, click on the icon on the right-hand side of the container.

Under ActiveMQ, All the details of the broker will be shown on the right-hand side of the console. Look for "Open wire url" as we are going to need later.

4. In your FUSE IDE, create a Fuse Project .

One of the great thing about FUSE IDE, is that you don't need to find all the dependency on your own, many sample archetype are ready done for you to reference it!  Choose activemq for this demo.

Group ID: org.blogdemo 
Artifact ID: camel-amq

delete the default example, we are going to create a new one.

Under src/main/resources/META-INF/spring , create a Camel XML file.

5.  Configure the ActiveMQ broker URL we previously get from the console on ActiveMQComponent. And don't forget also to put in the ID/PWD.


6.To create the first route,

Set an endpoint by dragging it on to the canvas.

By using a camel component timer, we can set this route to be executed in every 5 sec.

Drag a log component on to the canvas.

Click the log component on the canvas, you will be able to enter the log message in the properties tag below.

Under Transformation, drag setBody component into canvas. This sets the message to send into the queue.

Drag another log component to log the message content by setting the following content below.
printing body => ${body}

Create another endpoint pointing to the queue. Set the Uri to activemq:queue:demo

the activemq:queue:demo looks quite familiar? Yes, it's the bean that we set at the very beginning of camel config xml.

Connect all the components together by dragging the arrow from one component to the next one.

Save. We have completed the first route.

7. Right click on the xml file, select Run AS -> Local Camel Context (Without tests) to run the xml.

You will be able to see the content we set in the log.

The camel xml is as follows: (Please not the port is depended your activemq open wire URI)


8. Next step is to create the second route. This one is much easier. It simple listen to the demo queue. and print every message that sent into it.

Again, go to src/main/resources/META-INF/spring and create another Camel XML file.

name : camelListener.xml 

Add the Broker bean and it's URL and ID/PWD into camelListener.xml.

Drag Endpoint to canvas, under Properties -> Detail set the uri to activemq:queue:demo so this endpoint will listen to the queue that data was sent.

Add log to print out the content of the message received. Set the following to the message.
msg body => ${body}

Connect both components together by dragging the arrow from first component to the second one.

Done, and remember to save.

The whole Camel xml is as follows.


9. Right click on the camelListner.xml file, select Run AS -> Local Camel Context (Without tests) to run the xml.

You will be able to see the message we sent to the queue from log.

10. Deploying Camel project into fabric. To do this, we are going to build it with maven then deploy on to Profile through maven.

There are several ways to deploy onto Fabric Profile. This time we are going to install as a OSGi Bundle. For that, please replace your current pom.xml to following pom.xml.



  A Camel Spring Route


      FuseSource Release Repository
      FuseSource Snapshot Repository

      FuseSource Release Repository
      FuseSource Snapshot Repository









For pom.xml nothing much has changed, only we ask it to package as a bundle.


And add the bundle plugin. 


Go to the project directory, execute mvn clean install

11. In Fuse prompt add a profile blogdemoP
JBossFuse:karaf@root> profile-create blogdemoP

Deploy the camel-amq project we just created onto the Profile via maven.
JBossFuse:karaf@root> profile-edit -b mvn:org.blogdemo/camel-amq/1.0.0-SNAPSHOT blogdemoP

12. We are going to create a container in Fuse Console.  Then add the profile we just created onto the container.  Click on "+Container".
Name the new container : demo, on the button left corner, add full profile.

Add blogdemoP Profile too. Then click on "Create And Start Container"
在左邊下方,安裝剛剛建立的blogdemoP Profile, 然後按下左上方的 "Create And Start Container"

After demo container started, click on the detail icon on the right hand side.

A Popup window or tab will display the status and config of the chosen container. Click on Logs to see what's going on.

That's all.

In the Fuse Console,

In the demo container ,Click on Camel,  with left menu Routes -> Attributes you can see how many times the route has been executed.

Click on the route if you want to see more specific details on the route. Like how many times each component has been executed.

As with the Diagram Tab, It will display all the endpoint and route in a very grasphical way.

Configuration of each route can be seen by clicking on the route on the diagram itself.

ActiveMQ details are also shown on the console. Go to Master Broker's container detail by clicking on the icon. 

On the left-hand menu choose queue, under Attributes, you will able see the stats on each queue.


Irfan Siddique said…
Hi Cristina.

Very very good Tutorial.

I am getting this error.

rovision Exception:

org.osgi.service.resolver.ResolutionException: Unable to resolve dummy/0.0.0: missing requirement [dummy/0.0.0] osgi.identity; osgi.identity=org.blogdemo.camel-AMQ; type=osgi.bundle; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]" [caused by: Unable to resolve org.blogdemo.camel-AMQ/1.0.0.SNAPSHOT: missing requirement [org.blogdemo.camel-AMQ/1.0.0.SNAPSHOT] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.apache.camel)(version>=2.15.0)(!(version>=3.0.0)))"]

at org.apache.felix.resolver.Candidates.populateResource(

at org.apache.felix.resolver.Candidates.populate(

at org.apache.felix.resolver.ResolverImpl.resolve(

at io.fabric8.agent.DeploymentBuilder.resolve(

at io.fabric8.agent.DeploymentAgent.doUpdate(

at io.fabric8.agent.DeploymentAgent$

at java.util.concurrent.Executors$


at java.util.concurrent.ThreadPoolExecutor.runWorker(

at java.util.concurrent.ThreadPoolExecutor$


Please help.


Kind Regards
Irfan Siddique
Christina Lin said…
Hi Irfan,

I think you left out the part where I added a "full" profile in the container. :)
Irfan Siddique said…
Hi Cristina.

I ogt the problem. It was wrong version of Apache Camel. Jboss fuse use 2.12.0 camel version. but my project was with 2.15.0. I changed and it is working fine.


Kind Regards
me said…
Thank you so much for this.

I believe you forgot to mention a step to add a queue to the broker.

Thanks once again!
bhavin shah said…
Hi Christian,

I am using Fuse 6.2. Issue I am having is in step 12. When I create Container with Full profile then it creates new Openwire Url endpoint as compared to the OpenWire Url values in our Route after we create the Broker.

I am still getting my head around Fuse and OSGI, would it make sense to use the profile of our Route in the Broker Container.

Please let me know.



Popular posts from this blog

Red Hat Fuse - Announcing Fuse 7 Tech preview 3 release.

Red Hat Fuse 7.0 technical preview three is out today! On the pathway to become one of the best cloud-native integration platform, Fuse gives developer freedom to choose how they want to develop the integration solution, where they want to deploy it and capabilities to address new integration personas that do not have development experience.
By supporting the three major runtime, developer is free to work on the runtime of their choice.By supporting standalone and cloud deployment, it simplifies the complexity to distinguish between these environments, allowing application to deploy freely among the environment of your choice. All levels of developers are welcome, you can either dive deep into creating customize complex integration logic, or using the new low code platform to quickly build a simple integration. In this Tech Preview release you get it all.
Fuse StandaloneSpring-boot for microserviceKaraf 4 for OSGi loverJBoss EAP for JavaEE developersFuse on OpenShiftPlugins for easy co…

JBoss EAP 6 - 效能調校 (一) DataSource 的 Connection Pool

效能沒有什麼Best Practice, 反正能調整的就那些。 通常,一個程式的效能大概有70-80% 都跟程式怎麼寫的其實比較有關係。

最近我最疼愛的小貓Puji 因為膀胱結石開刀的時候過世了,心情很差請原諒我的口氣沒有很好,也沒有心情寫部落格。

Puji R.I.P.



JBoss 的 SubsystemDatasource WebWeb Service EJB Hibernate JMSJCAJVM 調校OS (作業系統)

先來看一下 DataSource Subsystem, DataSource 的部分主要是針對Connection Pool 做調校。

通常,程式都會需要跟資料庫界接,電腦在本機,尤其是在記憶體的運算很快,但是一旦要外部的資源連接,就是會非常的耗資源。所以現在的應用程式伺服器都會有個Pool 放一些先連接好的 資料庫connection,當程式有需要的時候就可以馬上提供,而不用花那些多餘的資源去連接資料庫。

這就是為什麼要針對Connection Pool 去做調校。

以下會討論到的參數,都是跟效能比較有關係,Datasource 還有很多參數,像是檢核connection 是否正確的,我都不會提到。如果你追求的是非常快速的效能,那我建議你一個檢核都不要加。當然,這樣就會為伺服器上面執行的程式帶來風險。這就是你要在效能與正確,安全性上面的取捨了。 (套句我朋友說的話,不可能又要馬兒好,又要馬兒不吃草的..)

最重要的調校參數就是 Connection 的 Pool 數量。(也就是那個Pool 裡面要放幾條的connection.) 這個參數是每一個應用程式都不一樣的。


Connection Pool 最少會存留的connection 數量


Connection Pool 最多可以開啓的 connection 數量


事先將connection pool 裡面建立好min-pool-size 的connection.

我的建議是觀察一下平常程式要用到的量設定為 min-pool-size 。

My 2cents on the future of Integration - With Service Mesh/Istio and Serverless/KNative

It's been a year and half since I blogged about "Agile Integration architecture" (Gosh, time just flies). With the "microservices" and "cloud-native" hype, I was especially curious on how all these new concept and technology affect us on how to architect the integration systems. If you ever pay close attention to all the latest and greatest news from the Kubernetes community, I am sure you will hear a lot about the new "Service Mesh". And rumor has it that this is how integration can/should be done in cloud native world, but, is that so? Anyone who has ever worked on an integration project would tell you, it's a LOT more COMPLEX and can get worst overtime. I did a talk with Christian Posta in Red Hat Tech Exchange coming from a more comprehensive view of how different Red Hat technologies are applied under different patterns when building integration solutions. In fact he also did a great blog about it.

Since then, another topics has be…