97008 48403
+91 40-27177600

Blog

How to Integrate Apache ActiveMQ with Mule ESB?

single-blog

From the technical center of excellence of Massil Technologies, our technology leader Srini makes it easy to understand the complex situations you come across in Mule ESB from the experience of Massil Technologies to have countered them in their experience of working on client projects in real time. This blog addresses how to integrate Apache ActiveMQ with Mule ESB. This blog is a part of series of blogs being authored and published by Massil Technologies for the benefit of the IT community globally.

What is ActiveMQ?

Apache ActiveMQ is the most reputed and powerful messaging and integration patterns server in opensource. The best part of ActiveMQ is that it is lightning fast, supports multiple languages, clients and protocols. It comes with easy to use Enterprise Integration Patterns and vast gamete of advanced features that completely supports JMS 1.1 and J2EE 1.4.

Key Features of ActiveMQ:

Source: http://activemq.apache.org/

  • Supports a variety of Cross Language Clients and Protocols from Java, C, C++, C#, Ruby, Perl, Python, PHP
  • OpenWire for high-performance clients in Java, C, C++, C#
  • Stomp support so that clients can be written easily in C, Ruby, Perl, Python, PHP, ActionScript/Flash, Smalltalk to talk to ActiveMQ as well as any other popular Message Broker
  • AMQP v1.0 support
  • MQTT v3.1 support allowing for connections in an IoT environment.
  • Full support for the Enterprise Integration Patterns both in the JMS client and the Message Broker
  • Supports many advanced features such as Message Groups, Virtual Destinations, Wildcards and Composite Destinations
  • Fully supports JMS 1.1 and J2EE 1.4 with support for transient, persistent, transactional and XA messaging
  • Spring Support so that ActiveMQ can be easily embedded into Spring applications and configured using Spring’s XML configuration mechanism
  • Tested inside popular J2EE servers such as TomEE, Geronimo, JBoss, GlassFish and WebLogic
  • Includes JCA 1.5 resource adaptors for inbound & outbound messaging so that ActiveMQ should auto-deploy in any J2EE 1.4 compliant server
  • Supports pluggable transport protocols such as in-VM, TCP, SSL, NIO, UDP, multicast, JGroups and JXTA transports
  • Supports very fast persistence using JDBC along with a high-performance journal
  • Designed for high-performance clustering, client-server, peer-based communication
  • REST API to provide technology agnostic and language-neutral web-based API to messaging
  • Ajax to support web streaming support for web browsers using pure DHTML, allowing web browsers to be part of the messaging fabric
  • CXF and Axis Support so that ActiveMQ can be easily dropped into either of these web service stacks to provide reliable messaging
  • Can be used as an in-memory JMS provider, ideal for unit testing JMS

Integrating ActiveMQ in Mule ESB:

Run ActiveMQ in your system by downloading ActiveMQ from the following link

http://activemq.apache.org/activemq-5150-release.html

Download the package that is most suitable for your system. Extract the file and run batch file of ActiveMQ. It will be located in the bin folder of ActiveMQ.

Example C:\apache-ActiveMQ-5.15.0\bin

To run the batch file use this command in your command prompt ” ActiveMQ start”. Then it will run on your system at port no: 8161

You will find your admin portal at “http://localhost:8161/admin”

When you log in to your admin panel, it will prompt you with a dialogue box where you need to enter the username and password details as “admin” and “admin” as the default username and password for ActiveMQ.

You will see that there are two channels available to send a message to JMS:

  • Queue
  • Topic

The above image is explained with an example. In this example, we are going to create a topic called “Test”.

In Mule ESB, AnyPoint Studio, we follow the following steps:

Step-1: Create a new project

Step-2: Add HTTP connector from Mule pallet and configure it.

Step-3: Add JMS connector. Configure it as shown below

  • Select topic in under Basic Settings

  • Add connector configuration it will ask username and password which were used to login to your admin portal of ActiveMQ.

  • Add an ActiveMQ .jar file to the project. if you don’t find activeMQ.jar file go to ActiveMQ package downloader you can find activeMQ.jar.

Step-4: In this example to see the output we are adding a logger to the flow and writing a MEL expression #[payload]

Step-5: Run the Project

Step-6:

After successful running of the project go to the postman and send a message and hit send. Check the log for output.

Hope this article from Massil Technologies was useful for you. If you have any further queries on this topic, please reach out to info@massil.tech.

 

Leave a Reply

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

Contact Us

Get in touch with us

Scroll to top