Solace Publisher Subscriber Spring Integration Using JMS

Solace Publisher Subscriber Spring Integration Using JMS

You have seen many example of creating Solace Publisher and Consumer in previous tutorials . In this example I will show you how to create Solace Publisher and Consumer using JMS API and we will use MessageListener interface from JMS to listen message on Solace queue for Subscriber.

Tools needed:

1. Eclipse
2. Java 1.8
3. Maven 3.2.1
4. Solace jars already included in project for download (Version used:


  • First create maven project name: SolaceJMSPubSubSpring belwo is final project structure:

Solace Publisher Subscriber Spring Integration Using JMS

  • All dependencies for project: pom.xml:

  • Here you will have to mentioned your Solace properites:

  • For logging use this: log4j2.xml:

  • Spring main framework file to load spring related configuration: spring-context.xml:

  • I have separated out Solace related configuration javahonk-solace-context.xml in this file which is going to import in above spring-context file:

  • Main class responsible for creating a connection to the Solace and work as factory:

  • Publisher class which publish message to Solace queue:

  • Solace Subscriber class which will subscribe to the queue for new messages:

  • In this class I have combined both publisher and Subscriber because this is needed if you have requirement to publish and subscriber both on the queue:

  • That’s it. Now our final class which will start the application and publish and receive the messages on Solace queue:

  • Now to run the application please edit and put Solace queue name, Connection factory, vpn, subscriber and publisher user id and password in then right click –> Run As –> Java Application and if everything goes will you will see below message on console for publisher and subscriber:

Solace Publisher Subscriber Spring Integration Using JMS

For more information please visit Solace official web site here

Leave a Reply

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