JMS Connector – Mule 4
In this tutorial we will talk about how to use JMS connector with Apache ActiveMQ with various use cases and scenarios. Anypoint Connector for JMS (Java Message Service) (JMS Connector) enables sending and receiving messages to queues and topics for any message service that implements the JMS specification. JMS is a widely used API for message-oriented middleware. It enables the communication between different components of a distributed application to be loosely coupled, reliable, and asynchronous. The main features of JMS Connector include:
- Publish and subscribe pattern support on any given destination
- Listen and reply pattern support on any given destination
- Publish and consume pattern support on any given destination, with a fixed or temporary reply queue
Prerequisite
We would need to download apache ActiveMQ from http://activemq.apache.org/download.html
ActiveMQ Set Up
Unzip the archive downloaded. You should be able to see following.
Run the command D:\Application\apache-activemq-5.15.2\bin>activemq start to start the ActiveMQ.
Open http://localhost:8161/admin/ and you should be able to see page below. use “admin“ as username and password.
Integration with MuleSoft
Perform the steps below for ActiveMQ connection configuration
- Add the JMS config
- Select “ActiveMQ Connection” in the connection parameter.
- Now, you will need to add client jars to connect to Active MQ. Click on Configure to add the Client jars.
Dependency below would be added in POM.
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-client</artifactId>
<version>5.14.5</version>
</dependency>
You would also need to add the dependency for ActiveMQ broker (for non persistent in memory connection) or ActiveMQ Kaha DB (for persistent connection). Click on configure Broker dependency.
Dependency below would be added in POM.
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
<version>5.15.4</version>
</dependency>
- Enter the broker URL as tcp://localhost:61616 and test the connection. Test connection should be successful as below. if not then, check if your activeMQ is started properly or if the dependencies are loaded correctly.
Basic JMS operations
You can use JMS in your application to Send a message to queue or a topic using “Publish” JMS message processor.
Note: Also read about C Program – Structure & Keywords in C.
Follow Me
If you like my post please follow me to read my latest post on programming and technology.
https://www.instagram.com/coderz.py/
https://www.facebook.com/coderz.py
Leave a Comment