This project provides Spring Boot Auto-Configuration and an associated Spring Boot Starter for the Solace JMS API. The goal of this project is to make it easy to use Solace JMS within a Spring application so you can take advantage of all the benefits of Spring Boot auto-configuration.
For a high level introduction and explanation, you can also refer to the following blog post: https://solace.com/blog/devops/solace-jms-meet-spring-boot-starters
As stated this project provides a Spring Boot Auto-Configuration implementation and a Spring Boot Starter pom for the Solace JMS API. The goal of this project is to make it easier to use Solace JMS within Spring.
The artifacts are published to Maven Central so it should be familiar and intuitive to use this project in your applications.
Spring Boot Auto-Configuration for the Solace JMS supports both programmatic creation or JNDI lookup of JMS objects. To learn more about JNDI refer to the Obtaining JMS objects using JNDI tutorial.
See the associated solace-jms-sample-app
for an example of how this is all put together in a simple application. To use Solace JMS you need to do these steps:
- Update your build.
- Autowire the
ConnectionFactory
: - Configure the application to use a Solace PubSub+ service.
See the associated solace-jms-sample-app-jndi
for an example. To use JNDI with Solace JMS you need to do these steps:
- Update your build.
- Autowire the
JndiTemplate
for further use e.g.: in aJndiObjectFactoryBean
. - Configure the application to use a Solace PubSub+ service.
The releases from this project are hosted in Maven Central.
The easiest way to get started is to include the solace-jms-spring-boot-starter
in your application. For an example see the JMS Sample App in this project.
Here is how to include the latest spring boot starter in your project using Gradle and Maven. You can also add a specific version from Maven Central. Note that you'll need to include version 3.1.0 or later to use Spring Boot release 2.x.
compile("com.solace.spring.boot:solace-jms-spring-boot-starter:5.2.0")
<dependency>
<groupId>com.solace.spring.boot</groupId>
<artifactId>solace-jms-spring-boot-starter</artifactId>
<version>5.2.0</version>
</dependency>
To access the Solace message routing service, autowire the following connection objects in your code for JMS or JNDI:
@Autowired
private ConnectionFactory connectionFactory; // for JMS
@Autowired
private JndiTemplate jndiTemplate; // for JNDI
The, configuration of the JmsTemplate
can be entirely done through the application.properties
file located in the src/main/resources
folder. This is where users can control the Solace JMS API properties. Currently this project supports direct configuration of the following properties:
solace.jms.host
solace.jms.msgVpn
solace.jms.clientUsername
solace.jms.clientPassword
# Following properties do not apply when using JNDI, see below.
solace.jms.clientName
solace.jms.directTransport
Where reasonable, sensible defaults are always chosen. So a developer using a Solace PubSub+ message broker and wishing to use the default message-vpn may only set the solace.jms.host
. When using JNDI, the configured connection factory properties on the Solace message broker are taken as a starting point, including the clientName
and directTransport
configurations.
See SolaceJmsProperties
for the most up to date list of directly configurable properties.
Any additional supported Solace JMS API properties can be set through configuring solace.jms.apiProperties.<Property>
where <Property>
is the "Value" of the property in the "com.solacesystems.jms.SupportedProperty" table as defined in the Solace JMS API documentation, for example:
solace.jms.apiProperties.Solace_JMS_SSL_TrustStore=ABC
Note that the direct configuration of solace.jms.
properties takes precedence over the solace.jms.apiProperties.
.
For more information about Spring Boot Auto-Configuration and Starters try these resources:
- Spring Docs - Spring Boot Auto-Configuration
- Spring Docs - Developing Auto-Configuration
- GitHub Tutorial - Master Spring Boot Auto-Configuration
For more information about Solace technology in general please visit these resources:
- The Solace Developer Portal
- Understanding Solace technology.
- Ask the Solace community.