Code and Compile Guidelines
To begin working with the standard Solace JMS API, import the required packages: com.solacesystems.jms.*;
The Solace JMS API requires the use of standard Java distribution 1.8 or greater.
The JMS sample applications include a sample Ant build script that shows how to include Solace libraries on the CLASSPATH
during the compiler invocation.
Ensure that the CLASSPATH
set when invoking the javac compiler includes all the .jar
files in the lib
directory.
When developing applications that use Solace JMS, you should the information in the sections below.
Secure Connections and Authentication
The following requirements must be met to successfully code and compile an application that will use TLS/SSL client connections, client certificate authentication, or Kerberos authentication schemes.
Java 1.8 or later provides the required Java Secure Socket Extension (JSSE) APIs that are required to use Transport Layer Security (TLS)/ Secure Sockets Layer (SSL) encrypted connections to the event broker.
Kerberos Libraries
If your application will use a Kerberos client authentication scheme, the Kerberos libraries in the JVM are used by default. However, if you are using an OS other than Windows, you can use Kerberos libraries other than those provided by the JVM, if you add the following system properties. In this case, the Kerberos libraries in the default OS library directory will be used.
-Dsun.security.jgss.native=true
-Djavax.security.auth.useSubjectCredsOnly=false
You can also add the following system property to provide the path to Kerberos libraries located in a location other than the default OS library directory:
-Dsun.security.jgss.lib=<file path to Kerberos library>
Logging
The Solace JMS API uses Jarkarta Commons Logging to support different logging frameworks. Solace JMS applications can choose either log4j or java.util.logging
as their logging framework.
With log4j, the directory in which the log4j.properties
file and log4j
jar file exist is on the classpath. A sample log4j.properties
setup is shown below:
Including log4j.jar
without log4j.properties
on the classpath impacts program performance.
# Log4j configuration properties used log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%d %-5p [%c] %m%n # Second appender is set by default to level log4j.appender.A2=org.apache.log4j.net.SocketAppender log4j.appender.A2.RemoteHost=localhost log4j.appender.A2.Port=4445 # Categories log4j.additivity=false log4j.logger.com.solacesystems=ERROR, A1 log4j.additivity.com.solacesystems=false log4j.logger.com.solacesystems.jcsmp=WARN, A1 log4j.additivity.com.solacesystems.jcsmp=false log4j.logger.com.solacesystems.jms=WARN, A1 log4j.additivity.com.solacesystems.jms=false
Supported JMSX Properties
Solace JMS supports the following JMS‑defined (JMSX) properties.
Publishing client applications can set these properties in a message and consuming client applications can read those properties from a message.
Property | Type | Use |
---|---|---|
JMSXGroupID |
String |
The identity of the message group the message is part of. |
JMSXGroupSeq |
int |
The sequence number of the message within a group; the first message is 1, the second 2, on so on. |
JMSXUserID |
String |
The identity of the client sending the message. Note: The |