Java Reference
In-Depth Information
to the headers and properties of messages specifying which messages the consumer wants
to receive. For example, you could specify in your MDB that you want to handle only fra-
gile shipping requests as follows:
@ActivationConfigProperty
propertyName="messageSelector"
propertyValue="Fragile is TRUE")
As you might have noticed, the selector syntax is almost identical to the WHERE clause in
SQL, but the selector syntax uses message header and property names instead of database
column names. Selector expressions can be as complex and expressive as you need them to
be. They can include literals, identifiers, whitespace, expressions, standard brackets, logic-
al and comparison operators, arithmetic operators, and null comparisons. Table 4.2 sum-
marizes the common message selector types.
Table 4.2. Common message selector types
Type
Description
Example
Can be strings, exact or approximate
numeric values, or Booleans.
Literals
BidManagerMDB 100 TRUE
Can be a message property or header
name; case sensitive.
RECIPIENT NumOfBids Fragile
JMSTimestamp
Identifiers
Same as defined in the Java language
specification: space, tab, form feed, and
line terminator.
Whitespace
Comparison operators, such as =, >,
>=, <=, <>.
RECIPIENT='BidManagerMDB'
NumOfBids>=100
Comparison operators
All three types of logical operat-
ors—NOT, AND, OR—are supported.
RECIPIENT='BidManagerMDB' AND
NumOfBids>=100
Logical operators
IS NULL and IS NOT NULL compar-
isons.
Null comparison
Firstname IS NOT NULL
IS [NOT] TRUE and IS [NOT] FALSE
comparisons.
True/false comparison
Fragile is TRUE Fragile is FALSE
4.3.7. Using bean lifecycle callbacks
As you'll recall from chapter 3 , similar to stateless session beans, MDBs have a simple li-
fecycle (see figure 4.8 for a refresher). For each MDB, the container is responsible for the
following:
 
Search WWH ::




Custom Search