Testing Java Message Service (JMS) systems

Use the generic JMS plug-in to connect HCL OneTest™ API to a wide range of EAI platforms, which includes any vendor that provides an implementation of this Java™ standard. JMS provides a way of separating the application from the transport layer of providing data. The same Java classes can be used to communicate with different JMS providers by using the JNDI information for a specific provider. The classes first use a connection factory to connect to the queue or topic, and then use populate and send or publish the messages. On the receiving side, the clients then receive or subscribe to the messages

JMS Concepts

Here are brief descriptions of some of the JMS concepts that are discussed in the following sections.

JMS provider
An implementation of the JMS interface for a Message Oriented Middleware (MOM). Providers are implemented as either a Java JMS implementation or an adapter to a non-Java MOM.
JMS client
An application or process that produces and receives messages.
JMS producer
A JMS client that creates and sends messages.
JMS consumer
A JMS client that receives messages.
JMS message
An object that contains the data that is being transferred between JMS clients.
JMS queue
A staging area that contains messages that are sent and are waiting to be read. The messages are delivered in the order sent. A message is removed from the queue after being read.
JMS topic
A distribution mechanism for publishing messages that are delivered to multiple subscribers.

Message distribution models

JMS has two distribution models, and provides an API to distribute JMS messages between JMS clients.
Point-to-point (queuing) model

In the point-to-point or queuing model, a sender posts messages to a particular queue and a receiver reads messages from the queue. Here, the sender knows the destination of the message and posts the message directly to the receiver's queue. It is characterized by the following characteristics:

  • Only one consumer gets the message.
  • The producer does not have to be running at the time the consumer consumes the message, nor does the consumer need to be running at the time the message is sent.
  • Every message that is successfully processed is acknowledged by the consumer
Publish and subscribe model

In the publish/subscribe model messages are published to a particular message topic. Subscribers can register interest in receiving messages on a particular message topic. In this model, both the publisher and the subscriber are unaware of each other. A good metaphor for this model is the anonymous bulletin board. The following are characteristics of this model:

  • Multiple consumers can get the message.
  • There is a timing dependency between publishers and subscribers. The publisher must create a subscription for clients to be able to subscribe. The subscriber must remain continuously active to receive messages, unless it establishes a durable subscription. In that case, messages that are published while the subscriber is not connected are redistributed whenever it reconnects.

The following topics discuss the configuration and use of JMS technologies in HCL OneTest API.