Entering content frame

This graphic is explained in the accompanying text Creating Message Selector Locate the document in its SAP Library structure

Use

Many applications need to filter and separate the messages that are received into different categories, depending on the application requirements. In such cases, you can use the JMS message selection, which allows the application to get only those messages that contain specific information, and to reject the messages that are useless for the application. When you have messages that are sent to many clients, the message selection criteria can be put in the header of the message. Then the JMS provider can handle a lot of the filtration work, and in this way can let the application work smoothly. Otherwise, if message selection is not used, then this job must be performed by the application itself.

You attach the specific criteria for the message selection using the message properties and specify the message selection criteria using the JMS message selection expressions.

For more information about the message selector syntax, see JMS Specification.

Procedure

Creating a message selector

This graphic is explained in the accompanying text

String selector;

selector = new String((name = “searched_string”) OR (name = “another_searched_string”));

Creating a message consumer with selector

·        When you use the Queue connection, the message consumer creation looks as follows:

This graphic is explained in the accompanying text

subscriber = topicSession.createSubscriber(topic, selector);

·        When you use the Queue connection, the message consumer creation looks as follows:

This graphic is explained in the accompanying text

receiver = queueSession.createReceiver(queue, selector);

The messages received by the application now contain the specified data in the message.

Example

For an example, see Using Message Filters.

 

 

Leaving content frame