Solace Spring Integration Example
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.
- Eclipse any latest version and for this tutorial Luna 4.4.0 has been used
- JDK 1.8
- Maven 3.2
- Solace 220.127.116.11
- Create maven project name: SolaceSpringIntegration below is final structure:
- Jars needed: If you are not using maven in your project please add below jars:
- 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:
- solace.properties: Please don’t forget to replace below properties with your Solace environment properties
- Bonus independent producer SolaceJMSPubihser.java class for test:
Download project source code: SolaceSpringIntegration