20.11.2. Selector filter
<type name="selector-filter" class="restricted" source="string" provides="filter"> <descriptor name="apache.org:selector-filter:string" code="0x0000468C:0x00000004"/> </type>
The qpid-java JMS "selector" defines an SQL like syntax for filtering messages. The selector filters based on the values of "headers" and "properties". The selector-filter uses the selector as defined by JMS but with the names of JMS headers translated into their AMQP equivalents. The defined JMS headers can be mapped to equivalent fields within the AMQP message sections:
The full list of headers is included in Section 20.6, “Java JMS Message Properties”.
When encoding the selector string on the wire, these JMS header names should be translated to
amqp.field_name
where field_name
is the appropriate AMQP 1.0 field named in the table above, with the hyphen replaced by an underscore. For example, the selector: JMSCorrelationID = 'abc' AND color = 'blue' AND weight > 2500
would be transferred over the wire as: amqp.correlation_id = 'abc' AND color = 'blue' AND weight > 2500
The "properties" of the JMS message are equivalent to the AMQP application-properties section. Thus a reference to a property Foo in a message selector would be evaluated as the value associated with the key "Foo" (if present) in the application-properties section.
The operands of the JMS selector are defined in terms of the types available within JMS, When evaluated against the application properties section, the values within that section are evaluated according to the following type mapping:
Table 20.15. Mapping AMQP types to JMS types
AMQP Type | JMS Selector Type |
---|---|
null
|
null
|
boolean
|
boolean
|
ubyte
|
short
|
ushort
|
int
|
uint
|
long
|
ulong
|
long
|
byte
|
byte
|
short
|
short
|
int
|
int
|
long
|
long
|
float
|
float
|
double
|
double
|
decimal32
|
double
|
decimal64
|
double
|
decimal128
|
double
|
char
|
char
|
timestamp
|
long
|
uuid
|
byte[16]
|
binary
|
byte[]
|
string
|
String
|
symbol
|
String
|