在ACTIVE MQ中显示“待处理消息数”是否有任何错误?

时间:2014-02-07 07:28:45

标签: java web-services activemq mule esb

我们正在将mule ESB JMS的活动mq用于我们的Web服务。它工作正常。但问题是,即使请求从队列转发到我的服务,处理并返回响应,但仍然在Active MQ Web控制台中,显示总请求数的待处理消息数。 Web控制台:: enter image description here

流程图,

Mule中的流程是::

<jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/>
    <flow name="vbrtestmulejmsFlow1" doc:name="vbrtestmulejmsFlow1">
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8888" doc:name="HTTP" path="AMServices">
         <set-property propertyName="Content-Type" value="text/xml"/>
        </http:inbound-endpoint>
        <object-to-string-transformer doc:name="Object to String" mimeType="text/xml"/>
        <jms:outbound-endpoint queue="servicesQueue" connector-ref="Active_MQ" doc:name="JMS" responseTimeout="1000000" mimeType="text/xml" >
        </jms:outbound-endpoint>

        <http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="5050" path="MyServices" method="POST" doc:name="HTTP" contentType="text/xml">
          <set-property propertyName="Content-Type" value="text/xml"/>
        </http:outbound-endpoint>
    </flow>

1 个答案:

答案 0 :(得分:0)

您的流将入站HTTP端点收到的消息发送到两者 JMS出站端点和HTTP出站端点。

因此预计servicesQueue将包含6条消息,同时MyServices将被调用6次。

您的意图尚不清楚,但如果您想要的是让servicesQueue充当入站和出站HTTP端点之间的中介,那么您需要将流量减少到两个:

<flow name="AMServiceToQueue">
    <http:inbound-endpoint exchange-pattern="request-response" host="localhost"
          port="8888" path="AMServices">
     <set-property propertyName="Content-Type" value="text/xml"/>
    </http:inbound-endpoint>
    <object-to-string-transformer mimeType="text/xml"/>

    <jms:outbound-endpoint queue="servicesQueue" connector-ref="Active_MQ"
         exchange-pattern="request-response" responseTimeout="1000000" />
</flow>

<flow name="QueueToMyServices">
    <jms:inbound-endpoint queue="servicesQueue" connector-ref="Active_MQ"
         exchange-pattern="request-response" />

    <http:outbound-endpoint exchange-pattern="request-response" host="localhost"
          port="5050" path="MyServices" method="POST" contentType="text/xml">
      <set-property propertyName="Content-Type" value="text/xml"/>
    </http:outbound-endpoint>
</flow>