Solace Spring Integration Example

Solace Spring Integration Example

Overview:

The purpose of this document is to outline how to use Solace JMS messaging and connect to the queue to publish or consume messages. This tutorial will cover an integration guide for using Solace JMS as a JMS provider using Spring Framework.

Spring Framework provides inclusive programming and configuration model for any Java-based small or big application where any kind of deployment platform can be used. The main element of spring is infrastructural level support which comes with the application.

The Solace message router supports persistent and non-persistent JMS messaging with high throughput and low, consistent latency. It’s very high capacity and built-in virtualization; each Solace message router can replace dozens of software-based JMS brokers in multi-tenant deployments. Since JMS is a standard API, client applications connect to Solace like any other JMS broker application. So if applications are struggling with performance or reliability issues can easily overcome them by upgrading to Solace’s hardware as per feedback from many of its users.

Integrating with Spring Framework

There are many ways to integrate Spring Framework and Solace JMS. Configuration outlined in this document makes use of spring messaging resource caching and JNDI object caching to achieve the integration with Solace.

In order to illustrate the Spring Framework integration following sections will highlight the required Spring Framework configuration changes and provide snippets of sample code to connect to the Solace queue. Here you will see how to configure spring application to send and receive JMS messages using a shared JMS connection. This requires completion of the following steps.

Tools needed:

  • Eclipse any latest version and for this tutorial Luna 4.4.0 has been used
  • JDK 1.8
  • Maven 3.2
  • Solace 6.2.0.64

Steps:

  • Create maven project name: SolaceSpringIntegration below is final structure:

Solace Spring Integration Example

 

  • Jars needed: If you are not using maven in your project please add below jars:

Solace Spring Integration Example

  • For maven project please use below pom.xml file:

Spring context files: Here we will keep file separate one for only Solace configuration and another is spring context as below:

  • spring-context.xml:

  • solace-context.xml:

  • log4j2.xml:

  • solace.properties: Please don’t forget to replace below properties with your Solace environment properties

  • SolaceMessageConsumer.java:

  • SolaceMessageProducer.java:

  • JavaHonkSolaceMessageTestApp.java:

  • Bonus independent producer SolaceJMSPubihser.java class for test:

Reference:

Download project source code: SolaceSpringIntegration

Leave a Reply

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