Solace Topic Queue Publisher Subscriber Java Example

Solace Topic Queue Publisher Subscriber Java Example

In recent posts you saw many tutorials on Solace. In this tutorial I will show you how to develop Solace adapter which can be use to publish message on queue/topic and subscriber to get message from queue/topic.

Tools needed:

  • Eclipse (Any updated version)
  • Java 1.8
  • Maven 3.2.5 (It comes with Eclipse)
  • Solace version 7.1.2.230

Maven project SolaceJMSPublisherSubscriber details structure below:

Solace Topic Queue Publisher Subscriber Java Example

  • Dependencies maven pom.xml:

  • log4j2.xml:

  • javahonk-solace.properties: Here you will enter all solace related properties. Please don’t forget to replace this file value with your own Solace properties:

  • spring-context.xml: Main spring context file to load all configurations:

  • javahonk-solace-context.xml: Seperate properties file to load all Solace related beans:

  • JavaHonkQueuePublisher.java: Solace publisher class to publish the message on Solace queue:

  • JavaHonkQueueSubscriber.java: Solace queue subscriber class to get and process messages from the queue:

  • JavaHonkTopicPublisher.java: Publisher which publish message on Solace Topic:

  • JavaHonkTopicSubscriber.java: Subscriber class which subscriber and process messages from the Solace Topic:

  • QueuePublisherMainApp.java: Test class to publish and subscriber message from the queue:

  • TopicPublisherMainApp.java: Main test class which publish and subscriber message from Solace Topic:

  • To run the application to consume and publish message on queue, right click QueuePublisherMainApp.java –> Run As –> Java Application and if everything goes well you will see message sent & receive details on the console:

Solace Topic Queue Publisher Subscriber Java Example

  • Same you could to if you want to publish and subscriber message form the topic, right click TopicPublisherMainApp.java –> Run As –> Java Application
  • For more information please read Solace official documentation here

Download project: SolaceJMSPublisherSubscriber

Leave a Reply

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