简体   繁体   中英

Generic JMS Client with SSL connection capability

Currently, I have implemented a non-SSL secured client using the standard JMS API (only javax.jms.* classes). When supplied with specific product JAR and proper classnames, it is able to connect to any JMS server.

Is there a way how to implement such generic (vendor-independent) JMS client with SSL connection capabilities?

My research was not successful - I've found several examples implementing JMS with SSL (eg Novell JMS , ActiveMQ ) but none of them avoids using the vendor-specific classes directly in code and implementations differ considerably.

Using SSL doesn't require any code change in client. Adding SSL capability is only matter of configuration.

In general, there are few things that will differ:

  1. Connection URL so the client connects over SSL protocol to proper port ( ssl://broker_url instead of tcp://broker_url ).
  2. Connection factory class - may be different from non-SSL one.
  3. Keystore and/or truststore to be used. Paths to these files may be set programmatically using specific methods – but this approach requires vendor specific code to be implemented. Better option is to pass the KS/TS java system properties. (This can be done even without any preparation using the -D JVM option.)

Since points 2. and 3. differ from one JMS broker to another, see your vendor's documentation for further details.


This answer is based on experience with successful connection to Apache ActiveMQ and Tibco EMS, including mutual certificate authentication.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM