title: How to inject a message selector to message listener bean in jms-spring integration?
body: <p>I'm working with JMS API (with HornetQ) and i'm using spring beans for message listener container and message listener:</p>
  
  <pre><code>&lt;bean id="messageListener" class="core.messaging.handler.MessageListener"&gt;
      &lt;property name="postCommandService" ref="postCommandService" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="messageSender"
      class="lsn.messaging.sender.MessageSender"&gt;
      &lt;property name="connectionFactory" ref="connectionFactory" /&gt;
      &lt;property name="destination" ref="destination" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="msgListenerContainer"
    class="org.springframework.jms.listener.DefaultMessageListenerContainer" 
    p:connectionFactory-ref="connectionFactory"
    p:destination-ref="destination"
    p:messageListener-ref="messageListener"
    p:concurrentConsumers="10"
    p:maxConcurrentConsumers="50"
    p:receiveTimeout="5000"
    p:idleTaskExecutionLimit="10"
    p:idleConsumerLimit="5" /&gt;
  </code></pre>
  
  <p>If i want my message listener, only consume specific messages (that have same StringProperty) what should i do? Where should i define selector?</p>
  
  <p>I have below solution, but i don't have MessageConsumer and so i can't add selector to it:</p>
  
  <pre><code>     String redSelector = "color='red'";
  
       MessageConsumer redConsumer = session.createConsumer(queue, redSelector);
       redConsumer.setMessageListener(new SimpleMessageListener("red"));
  
       TextMessage redMessage = session.createTextMessage("Red");
       redMessage.setStringProperty("color", "red");
  
       producer.send(redMessage);
  </code></pre>