<p>Once configured the queue <code>selectorQueue</code> only delivers messages that are
that match the selector; i.e. only the messages whose <code>color</code> property is equal to <code>'red'</code> can be received by its consumers.
Those that don't match the selector will be dropped by the queue and therefore will never be delivered to any of its consumers.</p>
<p>In the example code, five messages with different <code>color</code> property values are sent to queue <code>selectorQueue</code>.
One consumer is created to receive messages from the queue. Of the five sent messages, two have a <code>color</code> property
set to <code>'red'</code>, one has it set to <code>'blue'</code>, another to <code>'green'</code>,
and one has not the <code>color</code> property at all. The result is that the consumer only gets the two messages
with the <code>'red'</code> color.</p>
<h2>Example step-by-step</h2>
<p><i>To run the example, simply type <code>mvn verify</code> from this directory</i></p>
<ol>
<li>First we need to get an initial context so we can look-up the JMS connection factory and destination objects from JNDI. This initial context will get it's properties from the <code>client-jndi.properties</code> file in the directory <code>../common/config</code></li>
<li>Waiting for the message listener to check the received messages.</li>
<preclass="prettyprint">
<code>
Thread.sleep(5000);
</code>
</pre>
<li>And finally, <b>always</b> remember to close your JMS connections and resources after use, in a <code>finally</code> block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objects</li>