Messaging System Filter

Contents

Overview

A messaging system is a loosely coupled, peer-to-peer facility where clients can send messages to, and receive messages from any other client. In a messaging system, a client sends a message to a messaging agent. The recipient of the message can then connect to the same agent and read the message. However, the sender and recipient of the message do not need to be available at the same time to communicate (for example, unlike HTTP). The sender and recipient need only know the name and address of the messaging agent to talk to.

The Java Messaging System (JMS) is an implementation of such a messaging system. It provides an API for creating, sending, receiving, and reading messages. Java-based applications can use it to connect to other messaging system implementations. A JMS provider can deliver messages synchronously or asynchronously, which means that the client can fire and forget messages or wait for a response before resuming processing. Furthermore, the JMS API ensures different levels of reliability in terms of message delivery. For example, it can ensure that the message is delivered once and only once, or at least once.

The Enterprise Gateway uses the JMS API to connect to other messaging systems that expose a JMS interface, including Oracle WebLogic Server, IBM MQSeries, JBoss Messaging, TIBCO EMS, IBM WebSphere Server, and Progress SonicMQ.

Important Note:
You must add the JMS provider JAR files to the Enterprise Gateway classpath for this filter to function correctly. If the provider's implementation is platform-specific, copy the provider JAR files to the INSTALL_DIR/ext/PLATFORM folder, where INSTALL_DIR points to the root of your product installation, and PLATFORM is the platform on which the Enterprise Gateway is installed (win32, Linux.i386, or SunOS.sun4u-32). If the provider implementation is platform-independent, you can place the JAR files in INSTALL_DIR/ext/lib.

Request Settings

The Request tab specifies properties of the request to the messaging system. You can configure the following fields:

JMS Service:
Select an existing JMS service from the drop-down list. You can configure JMS services globally on the External Connections tab in Policy Studio. For more details on configuring JMS services so that they can be used in this Connection filter, see the Messaging System topic.

Destination:
Enter the name of the JMS queue or topic that you want to drop messages on to.

Delivery Mode:
The Enterprise Gateway supports persistent and non-persistent delivery modes:

  • Persistent:
    Instructs the JMS provider to ensure that a message is not lost in transit if the JMS provider fails. A message sent with this delivery mode is logged to persistent storage when it is sent.
  • Non-persistent:
    Does not require the JMS provider to store the message. With this mode, the message may be lost if the JMS provider fails.

Priority Level:
You can use message priority levels to instruct the JMS provider to deliver urgent messages first. The ten levels of priority range from 0 (lowest) to 9 (highest). If you do not specify a priority level, the default level is 4. A JMS provider tries to deliver higher priority messages before lower priority ones but does not have to deliver messages in exact order of priority.

Time to Live:
By default, a message never expires. However, if a message becomes obsolete after a certain period, you may want to set an expiration time (in milliseconds). If the specified time to live value is 0, the message never expires.

Message ID:
Enter an identifier to be used as the unique identifier for the message. By default, the unique identifier is the ID assigned to the message by the Enterprise Gateway (${id}). However, you can use a proprietary correlation system, perhaps using MIME message IDs instead of Enterprise Gateway message IDs.

Correlation ID:
Enter an identifier for the message that the Enterprise Gateway uses to correlate response messages with the corresponding request messages. Usually, if $id is specified in the Message ID field above, it is also used here to correlate request messages with their correct response messages.

Message Type:
This drop-down list enables you to specify the type of data to be serialized and sent in the JMS message to the JMS provider. The option selected depends on what part of the message you want to send to the consumer.

For example, if you want to send the message body, select the option to format the body according to the rules defined in the SOAP over JMS recommendation. Alternatively, if you wanted to serialize a list of name-value pairs to the JMS message, choose the option to create a MapMessage.

The following list describes the various serialization options available:

  • Use content.body attribute to create a message in the format specified in the SOAP over Java Messaging Service recommendation:
    If this option is selected, messages are formatted according to the SOAP over JMS recommendation. This is the default option because, in most cases, the message body is to be routed to the messaging system. If this option is selected, a javax.jms.BytesMessage is created and a JMS property containing the content type (text/xml) is set on the message.
  • Create a MapMessage from the java.lang.Map in the attribute named below:
    Select this option to create a javax.jms.MapMessage from the Enterprise Gateway message attribute named below that consists of name-value pairs.
  • Create a BytesMessage from the attribute named below:
    Select this option to create a javax.jms.BytesMessage from the Enterprise Gateway message attribute named below.
  • Create an ObjectMessage from the java.lang.Serializable in the attribute named below:
    Select this option to create a javax.jms.ObjectMessage from the Enterprise Gateway message attribute named below.
  • Create a TextMessage from the attribute named below:
    Select this option to create a javax.jms.TextMessage from the message attribute named below.
  • Use the javax.jms.Message stored in the attribute named below:
    If a javax.jms.Message has already been stored in a message attribute, select this option, and enter the name of the attribute in the field below.

Attribute Name:
Enter the name of the Enterprise Gateway message attribute that holds the data that is to be serialized to a JMS message and sent over the wire to the JMS provider. The type of the attribute named here must correspond to that selected in the Message Type drop-down field above.

Use Shared JMS Session:
By default, each running instance of a Messaging System filter creates its own session (using its own thread) with the JMS provider. You can select this option to force all running instances of this filter to share the same JMS session (using a common shared thread) to the JMS provider. Reusing a shared session across multiple filter instances in this manner may result in performance degradation as each connection to the provider using the session blocks until the response (if any) is received.

Custom Message Properties:
You can set custom properties for messages in addition to those provided by the header fields. Custom properties may be required to provide compatibility with other messaging systems. You can use message attributes as property values. For example, you can create a property called AuthNUser, and set its value to ${authenticated.subject.id}. Other applications can then filter on this property (for example, only consume messages where AuthNUser equals admin).

To add a new property, click the Add button, and enter a name and value in the fields provided on the Properties dialog.

Response Settings

The Response tab specifies whether the Enterprise Gateway uses asynchronous or synchronous communication when talking to the messaging system. If you want the Enterprise Gateway to use asynchronous communication, select the No response radio button. If synchronous communication is required, you can select to read the response from either a temporary queue or from a named queue or topic.

When you select to use synchronous communication, the Enterprise Gateway waits on a message from a queue/topic from the messaging system. The Enterprise Gateway sets the JMSReplyTo property on each message that it sends. The value of the JMSReplyTo property is the queue, temporary queue, topic, or temporary topic that was selected in the Response Type drop-down list. It the responsibility of the application that consumes the message from the queue to send the message back to the destination specified in JMSReplyTo.

The Enterprise Gateway sets the JMSCorrelationID property to the value of the Correlation ID field on the Response tab to correlate requests messages to their corresponding response messages. If you select to use a temporary queue or temporary topic, this is created when the Enterprise Gateway starts up.

Response Type:
Select where the response message is to be placed using one of the following options:

  • No Response:
    Select this option if you do not expect or do not care about receiving a response from the JMS provider.
  • Response from Temporary Queue:
    Select this option to instruct the JMS provider to place the response message on a temporary queue. In this case, the temporary queue is created when the Enterprise Gateway starts up. Only the Enterprise Gateway can read from the temporary queue, but any application can write to it. The Enterprise Gateway uses the value of the JMSReplyTo header to indicate the location where reads responses from.
  • Take Response from Queue or Topic:
    If you want the JMS provider to place response messages on a named queue or topic, select this option, and enter the name of the queue or topic in the Destination field below.

Destination:
If a named queue or topic is to be used, enter its name in this field.

Selector:
The entered expression specifies the messages that the consumer is interested in receiving. By using a selector, the task of filtering the messages is performed by the JMS provider instead of by the consumer. The selector is a string that specifies an expression whose syntax is based on the SQL92 conditional expression syntax. The Process only receives messages whose headers and properties match the selector.

Time Out:
The Enterprise Gateway waits a certain time period for a response to be received before it times out. If the Enterprise Gateway times out waiting for a response, this filter fails. Enter the time out value in milliseconds.