InfoCenter Home >
4: Developing applications >
4.6: Java Technologies >
4.6.3: Java Message Service (JMS) overview >
4.6.3.1: Using the JMS point-to-point messaging approach

4.6.3.1: Using the JMS point-to-point messaging approach

This article describes the point-to-point messaging approach using WebSphere Application Server's default JMS provider, MQSeries. The MQSeries messaging server implements point-to-point communication. To enable the MQSeries point-to-point messaging support, you need:

  • MQSeries Version 5.2 or greater
  • With MQSeries Version 5.2, you need MQSeries SupportPac MA88

MQSeries can now act as a resource manager in application transactions, and WebSphere Application Server can act as the transaction coordinator. For example, when a client application sends a request, WebSphere Application Server, using MQSeries, puts the message on an out queue and waits for a response to return to the in queue. In this scenario, there is no guarantee the message was sent, or that the receiver received the message. These types of messages are known as non persistent messages.

The point-to-point messaging approach in WebSphere Application Server and MQSeries is illustrated in the following graphic:

point to point approach

Message delivery can be defined as:

  • Persistent - this is the default mode of delivery. The "message send" is logged into stable storage.
  • Non persistent - message delivery is not guaranteed. This mode of delivery improves performance and reduces storage overhead.

Message delivery properties can be set:

  • On the queue within the queue manager
  • On the queue object using the JMSAdmin tool
  • On individual messages within your JMS application

To define a queue in the JNDI namespace and to set the persistence properties for the queue, enter the following command in the MQSeries JMSAdmin tool:

InitCtx> DEFINE Q(TESTQ) PERSISTENCE(xxx)
Where xxx is one of the following:
APP (Default) Persistence is defined by the application
QDEF Persistence is defined by the queue default (Set in the queue manager)
PERS Messages are persistent
NON Messages are non-persistent

If your application sends a message and requires a reply, set a reasonable timeout value in your application to handle a delayed or "no" reply situation. The following application code waits for a maximum of 5000 milliseconds:

Message inMessage = queueReceiver.receive(5000);
Set a similar timeout in your reply message.

Transactions to MQSeries are boundary transactions not end-to-end transactions. This means that only a put to a queue, or a get from a queue is part of the transaction. The flow to a remote application is not part of the transaction. In order to guarantee the message is received by the remote application, define that message in the JMSAdmin tool as a persistent message.

WebSphere enterprise applications can use the JMS Listener function to automatically receive messages from input queues (JMS destinations) and to coordinate the processing of those messages. This enables automatic asynchronous delivery of messages to an enterprise application, instead of the application having to explicitly poll for messages on the queue. For more information on the JMS Listener function, see An overview of the JMS Listener.

   The link to the JMS Listener documentation will not work unless the WebSphere Application Server Enterprise Edition product extensions are installed on your system.

See the Support of the MQSeries Java Message Service resources article for configuration information.

Go to previous article: Java Message Service (JMS) overview Go to next article: Using the JMS publish/subscribe messaging approach

 

 
Go to previous article: Java Message Service (JMS) overview Go to next article: Using the JMS publish/subscribe messaging approach