来自接收器的组件没有拾取消息(线程问题?)

时间:2013-07-03 08:32:55

标签: multithreading mule

当从JMS队列(Websphere MQ)获取消息以便使用Mule(v.2.2.1)进行进一步处理时,我们会遇到虚假错误。下面我已经包含了受影响的服务以及Mule日志的摘录。第一个段,“DispatchThread:1”,服务按预期工作,第二个案例,“DispatchThread:6”,邮件丢失,即未处理。

如日志所示,消息排队作为processFooBar.service在两种情况下都要处理的事件,但在后一种情况下,它从未被选中以进行进一步处理。在工作示例中,它几乎立即被排队并处理。

我们怀疑这是由线程配置文件的不平衡引起的,即接收器线程配置文件等,但同时我们认为这是一个非常模糊的解释。有点担心消息会在没有跟踪的情况下丢失,即使我们增加线程数,如果系统负载增加,我们也可能会遇到同样的问题。

如果我们的怀疑得到确认,如果有人遇到同样的问题,他们对此采取了什么措施,我将不胜感激?我们将升级到Mule 3,但我怀疑这个问题与Mule 3没什么不同?

服务定义:

<service name="processFooBar">
    <inbound>
        <jms:inbound-endpoint queue="A.FROM.BAR"
                              connector-ref="fooConnector"
                              disableTemporaryReplyToDestinations="true">
            <transformers>
                <transformer ref="messageLogger"/>
                <transformer ref="jmsMessageToObjectTransformer"/>
                ...
                ..
            </transformers>
        </jms:inbound-endpoint>
    </inbound>
    ...
    ..
</service>

日志摘录:

...
..
@ESB-: 2013-06-24 10:31:37,319 DEBUG [DispatchThread: 1] org.mule.service.AbstractService - Service: processFooBar has received asynchronous event on: jms://A.FROM.BAR
@ESB-: 2013-06-24 10:31:37,319 DEBUG [DispatchThread: 1] org.mule.model.seda.SedaService - Service: processFooBar has received asynchronous event on: jms://A.FROM.BAR
@ESB-: 2013-06-24 10:31:37,319 DEBUG [DispatchThread: 1] org.mule.model.seda.SedaService - Service processFooBar putting event on queue processFooBar.service: MuleEvent: ..., endpointEncoding=UTF-8}
@ESB-: 2013-06-24 10:31:37,321 DEBUG [processFooBar.1] org.mule.model.seda.SedaService - Service: processFooBar dequeued event on: jms://A.FROM.BAR
@ESB-: 2013-06-24 10:31:37,331 DEBUG [processFooBar.1] org.mule.model.seda.SedaService - Service processFooBar polling queue processFooBar.service, timeout = 10,000
@ESB-: 2013-06-24 10:31:37,339 DEBUG [processFooBar.2] org.mule.DefaultMuleMessage - new copy of message for Thread[processFooBar.2,5,main]
@ESB-: 2013-06-24 10:31:37,367 DEBUG [processFooBar.2] org.mule.transformer.AbstractTransformer - Setting transformer name to: fooDecoderTransformer
@ESB-: 2013-06-24 10:31:37,368 DEBUG [processFooBar.2] org.mule.transformer.AbstractTransformer - java.lang.Object has been added as source type for this transformer, there will be no source type checking performed
@ESB-: 2013-06-24 10:31:37,368 DEBUG [processFooBar.2] org.mule.transformer.AbstractTransformer - Setting transformer name to: objectToStringTransformer
...
..
@ESB-: 2013-06-24 13:19:51,896 DEBUG [DispatchThread: 6] org.mule.service.AbstractService - Service: processFooBar has received asynchronous event on: jms://FOMS.FROM.FSM.Bar
@ESB-: 2013-06-24 13:19:51,896 DEBUG [DispatchThread: 6] org.mule.model.seda.SedaService - Service: processFooBar has received asynchronous event on: jms://FOMS.FROM.FSM.Bar
@ESB-: 2013-06-24 13:19:51,897 DEBUG [DispatchThread: 6] org.mule.model.seda.SedaService - Service processFooBar putting event on queue processFooBar.service: MuleEvent: ..., endpointEncoding=UTF-8}
...
..

1 个答案:

答案 0 :(得分:0)

Mule的最大线程默认值限制为16,因此您可以继续更改:

首先你可以

  1. 在JMS连接器上设置numberOfConsumers属性
  2. 在JMS连接器的receiver-threading-profile元素上设置maxThreadsActive属性
  3. <jms:activemq-connector name="jmsConnector" numberOfConsumers="15" brokerURL="vm://localhost">
        <receiver-threading-profile maxThreadsActive="15"/>
    </jms:activemq-connector>
    

    另一种解决方案是您可以设置流程处理策略,请参考以下链接: https://docs.mulesoft.com/mule-user-guide/v/3.5/flow-processing-strategies