Java Reference
In-Depth Information
A message selector is a String that contains an expression. The syntax of the expression
is based on a subset of the SQL92 conditional expression syntax. The message selector in
the example selects any message that has a NewsType property that is set to the value
'Sports' or 'Opinion' :
NewsType = 'Sports' OR NewsType = 'Opinion'
The createConsumer and createDurableSubscriber methods allow you to
specify a message selector as an argument when you create a message consumer.
The message consumer then receives only messages whose headers and properties match
the selector. (See “ Message Headers on page 356 , and “ Message Properties on page
356 . ) A message selector cannot select messages on the basis of the content of the message
body.
JMS Messages
The ultimate purpose of a JMS application is to produce and consume messages that can
then be used by other software applications. JMS messages have a basic format that is
simple but highly flexible, allowing you to create messages that match formats used by
non-JMS applications on heterogeneous platforms.
A JMS message can have three parts: a header, properties, and a body. Only the header is
required. The following sections describe these parts.
For complete documentation of message headers, properties, and bodies, see the docu-
mentation of the Message interface in the API documentation.
Message Headers
A JMS message header contains a number of predefined fields that contain values used by
both clients and providers to identify and route messages. Table 20-1 lists the JMS mes-
sage header fields and indicates how their values are set. For example, every message has
a unique identifier, which is represented in the header field JMSMessageID . The value
of another header field, JMSDestination , represents the queue or the topic to which
the message is sent. Other fields include a timestamp and a priority level.
Search WWH ::




Custom Search