Search Tutorials

Apache Camel + Spring + ActiveMQ + JBoss Fuse | JavaInUse

JBoss Fuse Tutorial - Apache Camel + Spring + ActiveMQ + JBoss Fuse


We will implement a simple Apache camel integration project with Apache Camel using Spring DSL and deploy it on Red Hat JBoss Fuse.

Apache Camel - Table of Contents

File Transfer Using Java DSL Apache Camel Apache Camel Java DSL + Spring Integration Hello World Example Apache Camel Exception Handling Using Simple Example Apache Camel Redelivery policy using example Integrate Apache Camel and ActiveMQ EIP patterns using Apache Camel Apache Camel Tutorial- Integrate Spring Boot+ Apache Camel Apache Camel Tutorial- Integrate with MySQL DB using SQL query Apache Camel EIP - Splitter and Aggregator pattern Apache Camel Unit Testing Apache Camel + Spring + Quartz Hello World Example Camel application deployment on JBoss Fuse Apache Camel + Spring + ActiveMQ + JBoss Fuse Apache Camel + Apache CXF SOAP Webservices Apache Camel + JAX-RS REST Webservice Apache Camel + CXFRS REST Webservice Apache Camel Routing Slip EIP Pattern Apache Camel Dynamic Router Pattern Apache Camel Load Balancer EIP Pattern Apache Camel Interceptors Apache Camel + Kafka Hello World Example Apache Camel - Marshalling/Unmarshalling XML/JSON Data Example Calling and Consuming Webservices using Apache Camel Apache Camel Tutorial - Send SMTP Email Using Gmail Apache Camel Tutorial - SEDA component Hello World Example


This tutorial is explained in the below Youtube Video.

Lets Begin

The camel configuration file is to be created in src->main->resources->META-INF->spring. This is the default path where camel looks for the config files.
We will create Eclipse Maven project as follows-
The pom file will be as follows-
	<project xmlns="" xmlns:xsi=""





The config file applicationContext.xml will be as follows. We have created a camel context. Inside the context we have written a camel route. This route logs any message that is sent to our queue.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
	xmlns:xsi="" xmlns:camel=""
	xmlns:osgi="" xmlns:cxf=""

	<camelContext id="camelId" xmlns="">
			<camel:from uri="amq:queue:queue1" />
			<camel:log message="Message returned from the queue is " />
We also need a file for configuring the ActiveMQ.
 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
	xmlns:xsi="" xmlns:camel=""
	xmlns:osgi="" xmlns:cxf=""

	<bean class="org.apache.activemq.camel.component.ActiveMQComponent"
		<property name="connectionFactory" ref="singleCF" />
		<property name="useSingleConnection" value="true" />
		<property name="usePooledConnection" value="false" />
		<property name="preserveMessageQos" value="true" />

	<bean class="org.springframework.jms.connection.SingleConnectionFactory"
		<property name="targetConnectionFactory" ref="AMQCF" />

	<bean class="org.apache.activemq.ActiveMQConnectionFactory" id="AMQCF">
		<property name="userName" value="admin" />
		<property name="password" value="admin" />
		<property name="brokerURL" value="tcp://localhost:61616" />

That is the only code required. Now run the following Maven command
Next go to fuse.bat and start it by double clicking on it.
To run the bundle that is generated in .m2 repo type the following command
-install mvn:com.javainuse/test-activemq/0.0.1-SNAPSHOT..
This gives us a bundle-id. Next run the start bundle-id command.
Our camel-file-transfer application is now up and running.
Go to JBoss Fuse url- localhost:8181.
Check the activemq queue as follows-
We will see the Queue queue1 created. Send any message to the queue and it will be get logged. This can be checked in the fuse.log file.

Download Source Code

Download it - Apache Camel integration with ActiveMQ

See Also

Spring Boot Hello World Application- Create simple controller and jsp view using Maven Spring Boot Tutorial-Spring Data JPA Spring Boot + Simple Security Configuration Pagination using Spring Boot Simple Example Spring Boot + ActiveMQ Hello world Example Spring Boot + Swagger Example Hello World Example Spring Boot + Swagger- Understanding the various Swagger Annotations Spring Boot Main Menu Spring Boot Interview Questions