2014-12-20 184 views
0

我有一个问题,我只使用aciveMq交换模式。ExchangeTimedOutException:没有收到OUT消息

我写了一个模块在ServiceMix中运行。它工作正常,除了它发送每个消息到死信队列(ActiveMQ.DLQ)。如果我检查消息,则dlqDeliveryFailureCause包含以下消息:java.lang.Throwable:Message Expired。

我查了JMSExpiration = 0

路线:

from("direct:" + reqOutQueue).id("reqInEnritch") 
    .log("Start dispatch") 
    .setExchangePattern(ExchangePattern.InOnly) 
    .recipientList().method(EsbDynamicRouter.class, "systemRoute").parallelProcessing(); 

功能,是什么给后面的端点列表:

@RecipientList 
public String[] systemRoute(@Body Object body) throws Exception 
{ 
    String[] result = null; 

    List<DispConfView> targetList; 
    int cikl = 0; 
    SystemQueueHelper systemInfo; 
    MessageHeaderHelper msgHeadHelp = new MessageHeaderHelper(body); 

    // The object contains the affected elements 
    targetList = dispHelp.getDispConfByMsgType(msgHeadHelp.getMsgType()); 

    result = new String[targetList.size()]; 

    for (DispConfView element : targetList) 
    { 
     // It builds the target andpoints 
     systemInfo = new SystemQueueHelper(element.getSystemCode(), null, msgHeadHelp.getDirection()); 

     result[cikl] = systemInfo.getQueuName(); 

     cikl++; 
    } 

    return result; 
} 

列表中包含这些值:

activemq:queue:ERP.req.in?exchangePattern=InOnly 
activemq:queue:WF.req.in?exchangePattern=InOnly 

如您所见,我尝试设置正确的模式,但每条消息都会发送到死信队列。

请帮助,我必须设置!

谢谢!

+0

我习惯于看到错误信息(后面跟着“NNNNN millis”中的单词),用于“InOut”交换,而不是“InOnly”。所以我要做的第一件事就是确认你是否确实设置了一个'InOnly'交换模式...... – Tim

+0

Hi Tim!你可以检查我的设置。我想我把所有的输出都设置为InOnly,但是如果你有任何其他的想法,我要怎么设置,请告诉我。我设置了路由交换模式,并设置了收件人列表元素。你知道任何其他地方,我可以在那里设置它吗?谢谢! – Feri

回答

1

解决办法: 正是在context文件设定:

<!-- JMS configuration --> 
<bean id="pooledJmsConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start" destroy-method="stop"> 
    <property name="maxConnections" value="1" /> 
    <property name="connectionFactory" ref="jmsConnectionFactory" /> 
</bean> 

<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> 
    <property name="brokerURL" value="failover:(tcp://localhost:61616)" /> 
    <property name="redeliveryPolicy"> 
     <bean class="org.apache.activemq.RedeliveryPolicy"> 
      <property name="maximumRedeliveries" value="5"/> 
     </bean> 
    </property> 
</bean> 

<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration"> 
    <property name="connectionFactory" ref="pooledJmsConnectionFactory"/> 
    <property name="cacheLevelName" value="CACHE_CONSUMER" /> 
    <property name="disableReplyTo" value="true" /> 
</bean> 

的 “jmsConfig豆 ”“ diasbleReplayTo” 属性解决问题。