当有多个jms或wmq连接器时使用mulerequester

时间:2015-10-21 17:54:37

标签: mule mule-component mule-el anypoint-studio

这是How to use Mule Expression in JMS:selector的延续,但是另一个问题。我正在使用mulerequester来读取队列,如下所示。

Responsive: (check in new window)
<table class="one-column">
  <tr class="one-column">
    <td class="three-column">
      <input type='radio' name='r1' value='1'>1</td>
    <td class="three-column">
      <input type='radio' name='r2' value='2'>2</td>
    <td class="three-column">
      <input type='radio' name='r3' value='3'>3</td>
  </tr>
  <tr>
    <td class="three-column">
      <div class="arrow-container">
        <span style='font-size:18pt;font-weight:bold;'>&#8627;</span><span style='padding:1px;border:2px solid black'><b style='font-size:8pt;'>20.</b></span>
      </div>
    </td>
    <td class="three-column">
      <div class="arrow-container">
        <span style='font-size:18pt;font-weight:bold;'>&#8627;</span><span style='padding:1px;border:2px solid black'><b style='font-size:8pt;'>20.</b></span>
      </div>
    </td>
    <td class="three-column">
      <div class="arrow-container">
        <span style='font-size:18pt;font-weight:bold;'>&#8627;</span><span style='padding:1px;border:2px solid black'><b style='font-size:8pt;'>20.</b></span>
      </div>
    </td>
  </tr>
</table>

Non-responsive: (no one-column class)
<table>
  <tr>
    <td class="three-column">
      <input type='radio' name='r1' value='1'>1</td>
    <td class="three-column">
      <input type='radio' name='r2' value='2'>2</td>
    <td class="three-column">
      <input type='radio' name='r3' value='3'>3</td>
  </tr>
  <tr>
    <td class="three-column">
      <div class="arrow-container">
        <span style='font-size:18pt;font-weight:bold;'>&#8627;</span><span style='padding:1px;border:2px solid black'><b style='font-size:8pt;'>20.</b></span>
      </div>
    </td>
    <td class="three-column">
      <div class="arrow-container">
        <span style='font-size:18pt;font-weight:bold;'>&#8627;</span><span style='padding:1px;border:2px solid black'><b style='font-size:8pt;'>20.</b></span>
      </div>
    </td>
    <td class="three-column">
      <div class="arrow-container">
        <span style='font-size:18pt;font-weight:bold;'>&#8627;</span><span style='padding:1px;border:2px solid black'><b style='font-size:8pt;'>20.</b></span>
      </div>
    </td>
  </tr>
</table>

如果我有一个wmqConnector,但我的mule项目(wmqconnector和wmqconnector1)中有2个wmq连接器,它指向不同的服务器。在运行时,当mulerequester解析“资源”中给出的URL时,它会遇到与wmq协议匹配的2个连接器,并且我收到以下错误消息“至少有2个匹配协议的连接器”wmq“,因此要使用的连接器必须是使用'connector'属性/属性在端点上指定。配置中支持“wmq”的连接器是:wmqConnector1,wmqConnector,(java.lang.IllegalStateException)“。我不知道如何告诉mulerequester wmqConnector使用哪个。

我提到mulerequester的mule文档,但无法找到任何解决方案。有什么建议吗?

2 个答案:

答案 0 :(得分:2)

将连接器作为uri Param传递:

<mulerequester:request config-ref="Mule_Requester" resource="jms://input?connector=AMQConnector1" doc:name="Request a message from a queue" />

答案 1 :(得分:0)

根据Ryan的建议,这是我修改过的mulerequester。它使用连接器和选择器作为Uri params。

 <mulerequester:request config-ref="Mule_Requester" resource="wmq://REPLY.QUEUE?connector=wmqConnector&amp;selector=JMSCorrelationID%3D'#[sessionVars.myCorrelationId]'" doc:name="Mule Requester" timeout="120000"/>