Skip to content

Latest commit

 

History

History

solace-jms-spring-boot-starter

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Spring Boot Auto-Configuration for the Solace JMS

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

Contents


Overview

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.

Using Auto-Configuration in your App

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.

Programmatic creation of JMS objects

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:

  1. Update your build.
  2. Autowire the ConnectionFactory:
  3. Configure the application to use a Solace PubSub+ service.

JNDI lookup of JMS objects

See the associated solace-jms-sample-app-jndi for an example. To use JNDI with Solace JMS you need to do these steps:

  1. Update your build.
  2. Autowire the JndiTemplate for further use e.g.: in a JndiObjectFactoryBean.
  3. Configure the application to use a Solace PubSub+ service.

1. Updating your build

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.

Using it with Gradle

compile("com.solace.spring.boot:solace-jms-spring-boot-starter:5.2.0")

Using it with Maven

<dependency>
	<groupId>com.solace.spring.boot</groupId>
	<artifactId>solace-jms-spring-boot-starter</artifactId>
	<version>5.2.0</version>
</dependency>

2. Autowiring Connection Objects

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

3. Configure the Application to use your Solace PubSub+ Service Credentials

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..

Resources

For more information about Spring Boot Auto-Configuration and Starters try these resources:

For more information about Solace technology in general please visit these resources: