Thursday, February 21, 2019

ActiveMQ - How to setup and run from Mule 3.9

  • Install ActiveMQ
    • Step 1: Download Apache Active MQ 5.x.x (5.15.8 Latest Version Up to Feb 2019)
    • Step 2: Install ActiveMQ
    • Run the Active MQ server(Run the command from any directory)
  • Enable ActiveMQ Web Console
    • Testing the Installation
    • Monitoring ActiveMQ
    • ActiveMQ Overview Page
  • Setting up & running Mule App with JMS Connector using Active MQ Service
    • Create New Mule App and Design Flow Active MQ with JMS
    • Adding the Maven Dependency in POM
    • Create A Queue in Active MQ
  • Test Active MQ From Mule
    • Enqueue the message in Active MQ  named bjit
    • Test the mule-3.9 app
    • Active MQ Test Project in Mule-3.9

Install ActiveMQ

Here is the quick installation guideline for Ubuntu 16.04 LTS
Step 1: Download Apache Active MQ 5.x.x (5.15.8 Latest Version Up to Feb 2019)
Step 2: Install ActiveMQ
Extract the Archive
sudo tar -zxvf apache-activemq-5.15.8-bin.tar.gz
Move to the activemq extracted folder
cd apache-activemq-5.15.8
Give permission to the executable  
chmod 755 activemq
Add the Environment Variable to the PATH
export ACTIVEMQ_HOME=/home/path-to-the-file-location/apache-activemq-5.15.8
export PATH=$PATH:$ACTIVEMQ_HOME/bin
Run the Active MQ server(Run the command from any directory)
command for start the server
activemq start
 
command for check status the server
activemq status
command for restart the server
activemq restart
For other Operating Systems please see the links below:
Installing oMac/Unix

Enable ActiveMQ Web Console

ActiveMQ provides a web console to manage it easily. To enable the console, run the commands below
activemq console
Testing the Installation
ActiveMQ's default port is 61616. From another window, run netstat and search for port 61616.
Monitoring ActiveMQ
There are various ways to monitor ActiveMQ. If you are on version 4.2 or later of ActiveMQ, you can then monitor ActiveMQ, using the Web Console by pointing your browser at:
After that, open your browser and browse to the server name or IP address followed by port # 8161(Jetty proxy)
You should see the ActiveMQ web management console to logon. The default username and password is the admin.
Username: admin
Password:  admin
ActiveMQ Overview Page

Setting up & running Mule App with JMS Connector using Active MQ Service

Create New Mule App and Design Flow Active MQ with JMS
Now create a new Mule project and add the following components to Mule flow:
Configure JMS Connector as ActiveMQ and broker url, user name , password






Adding the Maven Dependency in POM
<dependency>
  <groupId>org.apache.activemq</groupId>
  <artifactId>activemq-all</artifactId>
  <version>5.15.8</version>
</dependency>

Create A Queue in Active MQ
Login to ActiveMQ Web-console with admin user and create a queue with name "bjit" 
Sent The message 'Hello' to the JMS consumer
Now set the JMS Connector queue name as "bjit" to consume the queue messages
Set up the logger message and run the project.

Test Active MQ From Mule

Enqueue the message in Active MQ  named bjit
Test the mule-3.9 app
Check mule console log to check the output
Active MQ Test Project in Mule-3.9
For your convenience, the sample mule-3.9 project has been attached below
ActiveMQ Test App using Mule-3.9







No comments:

Post a Comment

5 Strategies for Getting More Work Done in Less Time

Summary.    You’ve got more to do than could possibly get done with your current work style. You’ve prioritized. You’ve planned. You’ve dele...