Spring and JMS Integration

To integrate spring with JMS, you need to create two applications.

  1. JMS Receiver Application
  2. JMS Sender Application

To create JMS application using spring, we are using Active MQ Server of Apache to create the Queue.

Let's see the simple steps to integration spring application with JMS:


Required Jar Files

1) You need to add spring core, spring misc,spring aop, spring j2ee and spring persistence core jar files.

download the all jar files for spring including aop, mvc, j2ee, remoting, oxm, etc.

2) Add activemqall5.9.jar file located inside the activemq directory.


Create a queue in ActiveMQ Server

Download the Active MQ Server Download Active MQ

Double Click on the activemq.bat file located inside apache-activemq-5.9.1-bin\apache-activemq-5.9.1\bin\win64 or win32 directory.

Now activemq server console will open.

Access the admin console of activemq server by http://localhost:8161/admin/ url.

Open activemq server

Now, click on the Queues link, write myqueue in the textfield and click on the create button.

create queue in activemq server

1) JMS Receiver Application

Let's see the simple steps to integration spring application with JMS:

  1. MyMessageListener.java
  2. TestListener.java
  3. applicationContext.xml
1) MyMessageListener.java

2) TestListener.java
3) applicationContext.xml

2) JMS Sender Application

Let's see the files to create the JMS Sender application:

  1. MyMessageSender.java
  2. TestJmsSender.java
  3. applicationContext.xml
1) MyMessageListener.java

2) TestJmsSender.java
3) applicationContext.xml





Latest Courses