I want to get a queue:
<jms:inbound-endpoint connector-ref="jmsConnector" queue="queue.dev" >
<jms:selector expression="JMSCorrelationID='353'"/>
</jms:inbound-endpoint>
It works but I want to use an expression in the selector:
<jms:inbound-endpoint connector-ref="jmsConnector" queue="queue.dev" >
<jms:selector expression="JMSCorrelationID='#[header:OUTBOUND:codeReport]'"/>
</jms:inbound-endpoint>
It's no working.
This doesn't make sense: you are trying to use an outbound property in an inbound endpoint. This can not work.
Where is the value for codeReport
supposed to come from? If a properties file then use ${codeReport}
.
EDIT: It turns out that, based on the OP's comments, the solution is to use a requester on the JMS queue, not an inbound endpoint. The following code demonstrates requesting messages until the queue is empty and returning them in a java.util.List
:
<scripting:component>
<scripting:script engine="groovy"><![CDATA[
def jmsMessages = []
for (def muleMessage = muleContext.client.request("jms://out.queue.dev?selector=JMSCorrelationID%3D'"+ message.getInboundProperty('codeReport') +"'", -1L);
muleMessage != null;) {
[] << muleMessage.payload
}
jmsMessages
]]></scripting:script>
</scripting:component>