JMS message selector

来源:百度文库 编辑:神马文学网 时间:2024/04/27 16:02:13
A message selector allows a JMS consumer to be more selective about the messages that it receives from a particular topic or queue.
A message selector uses message properties and headers as criteria in conditional expressions. These expressions use boolean logic to declare which messages should be delivered to a client, such as the JMSInput node.
The following table demonstrates the construction of a message selector. It comprises an identifier, such as the JMSPriority header, or an application controlled property myProperty1. The selector string must specify an operator followed by a literal.
Element Valid values
Identifiers Property or header field reference (such as JMSPriority, myProperty1) The following values are not possible: NULL, TRUE, FALSE, NOT, AND, OR, BETWEEN, LIKE, IN, IS
Operators
AND, OR, LIKE, BETWEEN, =, <>, <,>, <=, >=, IS NULL, IS NOT NULL
Literals The two boolean literals, TRUE and FALSE Exact number literals that have no decimal point; for example, +25, -399, 40 Approximate number literals. These can use scientific notation or decimal; for example, -21.4E4, 5E2, +34.4928
The JMSInput node provides a free format string PropertySelector, to specify selectors that filter or include application properties. The node also has attributes for specific header properties, where the identifier is implicit and is generated by the node. For the header selectors, the operator and literal part of the string must be specified.
If more than one selector is specified the node generates a composite selector string, where the individual selector strings are concatenated with the AND operator, and each selector string part is wrapped with parentheses.
The following are examples for each of the selector attributes: Selector attribute Description
PropertySelector OrderValue> 100.00
This string is used directly as shown.
TimeStamp BETWEEN 1057576423231 AND 10575788993265
Messages that are put between these two Java Times only (where Java time is milliseconds since 01 Jan 1970 ) is delivered to the JMSInput node. In this case the string generated is prefixed with the identifier JMSTimestamp.
Delivery Mode PERSISTENT
This means that only messages marked by the sender as being PERSISTENT should be delivered to the JMSInput node. In this case the string that is generated is prefixed with the identifier JMSDeliveryMode.
Priority >= 5 AND <= 8
This means that only messages marked by the sender as having a priority 5, 6, 7, or 8 should be delivered to the JMSInput node. In this case the string generated is prefixed with the identifier JMSPriority.
Message ID > WMBRK123456
This will return messages whose Message ID is greater than the value specified. In this case the string generated is prefixed with the identifier JMSMessageID.
Redelivered FALSE
This means that messages that have not been redelivered should be received by the node. In this case the string generated is prefixed with the identifier JMSRedlivered.
Correlation ID = WMBRKABCDEFG
This returns messages whose Correlation ID is equal to the value WMBRKBABCDEFG. In this case, the string generated is prefixed with the identifier JMSCorrelationID.
Related concepts
JMS Transactionality
Related reference
JMS properties for application communication models
JMS message domain properties