问题
This is continuation from How to use Mule Expression in JMS:selector but a different question. I am using mulerequester to read off the queue as shown below.
<mulerequester:request config-ref="Mule_Requester" resource="wmq://REPLY.QUEUE?selector=JMSCorrelationID%3D'#[sessionVars.myCorrelationId]'" doc:name="Mule Requester" timeout="120000"/>
It works if I have one wmqConnector but I have 2 wmq connectors in my mule project (wmqconnector and wmqconnector1), pointing to different servers. During runtime, when mulerequester resolve the URL given in the "resource", it encounters 2 connectors matching the wmq protocol and I get the following error message "There are at least 2 connectors matching protocol "wmq", so the connector to use must be specified on the endpoint using the 'connector' property/attribute. Connectors in your configuration that support "wmq" are: wmqConnector1, wmqConnector, (java.lang.IllegalStateException)". I am not sure how to tell mulerequester which wmqConnector to use.
I referred to mule documentation for mulerequester but couldnt find any solution. Any suggestions?
回答1:
Pass the connector as a uri Param like this:
<mulerequester:request config-ref="Mule_Requester" resource="jms://input?connector=AMQConnector1" doc:name="Request a message from a queue" />
回答2:
Here is my modified mulerequester as per Ryan's suggestion. It uses both connector and selector as Uri params.
<mulerequester:request config-ref="Mule_Requester" resource="wmq://REPLY.QUEUE?connector=wmqConnector&selector=JMSCorrelationID%3D'#[sessionVars.myCorrelationId]'" doc:name="Mule Requester" timeout="120000"/>
来源:https://stackoverflow.com/questions/33266088/using-mulerequester-when-there-are-more-than-one-jms-or-wmq-connector