Specifying which types of message to receive using the message selector

A message selector is a string containing an expression used to control which messages are consumed by which MDBs. The application used in this recipe submits different messages to the same queue. The messages are then sent to different MDBs based on their message selector settings.

Getting ready

The essential structure of a servlet used to generate a message was introduced in the introduction. We will be using a TextMessage to demonstrate the message selection process. This message type is discussed earlier in this chapter under the Handling a text-based message recipe. Here we will address the unique elements of creating and using a TextMessage to support a message selector ...

Get EJB 3.1 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.