Message Selection and Filtering

By default, a MessageConsumer will process every message that is sent to its destination, regardless of whether or not it is interested in the message. You can modify this behavior to allow MessageConsumers to process only the messages in which they have an interest. You do this by setting up a message filter. This filter will only allow (or select) messages that pass the filter.

There are two steps in setting up a Message filter:

1.
Initialize header and property fields in the message.
2.
MessageConsumers specify a query string to select certain messages based on the header and property fields.

The next section describes the two steps in more detail.

Setting Header and Property Fields

You have already seen ...

Get Special Edition Using Enterprise JavaBeans™ 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.