Sunday, May 31, 2020

Spring boot ActiveMQ example

ActiveMQ Setup

Download the latest version of ActiveMQ from below link

https://activemq.apache.org/components/classic/download/



Extract the zip file, go to bin folder and start activemq server using activemq.bat

In my case it is
apache-activemq-5.15.11/bin/win32/activemq.bat

Verify ActiveMQ server is UP and running

http://localhost:8161/


Note - You can change the default port 8161 by updating below file
apache-activemq-5.15.11/conf/jetty.xml

Go to admin page

http://localhost:8161/admin/

Login with default credentials

Username - admin
Password - admin



Note - You can change default credentials by updating below file
apache-activemq-5.15.11/conf/jetty-realm.properties

Here is how our data will flow



Please see the self explanatory code below, in our example server will push a message (Object) to queue ever 2 seconds and client will read the message.

Server

pom.xml
TestJmsServerApplication.java
application.properties
Client

pom.xml
TestJmsClientApplication.java
Receiver.java
application.properties


Download full source code from github

https://github.com/madan712/jms-server.git

https://github.com/madan712/jms-client.git