2012-10-19 56 views
4

我MULE從HornetQ的隊列中讀取和保存對象數據庫的非常簡單的設置:下面JMS騾子最大交還超過

設置:

<jms:connector name="connector.jms" maxRedelivery="1" connectionFactory-ref="hornetQConnectionFactory" doc:name="JMS" 
     createMultipleTransactedReceivers="true" 
     numberOfConcurrentTransactedReceivers="100" 
     acknowledgementMode="AUTO_ACKNOWLEDGE"> 
    <reconnect count="50" frequency="5000"/>  
</jms:connector> 
<flow name="jmsListenerFlow1" doc:name="jmsListenerFlow1"> 
    <jms:inbound-endpoint queue="adsLogQueue" connector-ref="connector.jms" doc:name="JMS"> 
     <jms:transaction action="ALWAYS_BEGIN"/> 
    </jms:inbound-endpoint> 
    <component > 
     <spring-object bean="logSaver"/> 
    </component> 

</flow> 

爲什麼我收到一條消息,該消息已被在maxRedelivery設置爲1時在端點上重新發送了9次?這究竟意味着什麼?

hornetQConnectionFactory:

 <bean name="hornetQTransportConfiguration" class="org.hornetq.api.core.TransportConfiguration"> 
     <constructor-arg value="org.hornetq.core.remoting.impl.netty.NettyConnectorFactory"/> 
     <constructor-arg> 
      <map> 
       <entry key="host" value="${jms.host}" /> 
       <entry key="port" value="${jms.port}" /> 
      </map> 
     </constructor-arg> 

    </bean> 
    <bean name="hornetQConnectionFactory" class="org.hornetq.jms.client.HornetQJMSConnectionFactory"> 
     <constructor-arg index="0" value="false"/> 
     <constructor-arg index="1" ref="hornetQTransportConfiguration"/> 
     <property name="minLargeMessageSize" value="250000"/> 
     <property name="cacheLargeMessagesClient" value="false"/> 
    </bean> 

任何幫助將不勝感激!

下面的堆棧跟蹤。

 
ERROR 2012-10-19 01:04:07,283 [Thread-3013 (HornetQ-client-global-threads-1442093417)]: 

Message    : "Message with id "ID:e6a0b303-1977-11e2-96d4-810571a3fe10" has been redelivered 9 times on endpoint "jms://adsLogQueue", which exceeds the maxRedelivery setting of 1 on the connector "connector.jms". Message payload is of type: HornetQObjectMessage 
Code     : MULE_ERROR--2 

Exception stack is: 
1. "Message with id "ID:e6a0b303-1977-11e2-96d4-810571a3fe10" has been redelivered 9 times on endpoint "jms://adsLogQueue", which exceeds the maxRedelivery setting of 1 on the connector "connector.jms". Message payload is of type: HornetQObjectMessage (org.mule.transport.jms.redelivery.MessageRedeliveredException) 
    org.mule.transport.jms.redelivery.JmsXRedeliveryHandler:91 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/transport/jms/redelivery/MessageRedeliveredException.html) 

Root Exception stack trace: 
org.mule.transport.jms.redelivery.MessageRedeliveredException: "Message with id "ID:e6a0b303-1977-11e2-96d4-810571a3fe10" has been redelivered 9 times on endpoint "jms://adsLogQueue", which exceeds the maxRedelivery setting of 1 on the connector "connector.jms". Message payload is of type: HornetQObjectMessage 
    at org.mule.transport.jms.redelivery.JmsXRedeliveryHandler.handleRedelivery(JmsXRedeliveryHandler.java:91) 
    at org.mule.transport.jms.MultiConsumerJmsMessageReceiver$JmsWorker.preProcessMessage(MultiConsumerJmsMessageReceiver.java:418) 
    at org.mule.transport.AbstractReceiverWorker$1$1.process(AbstractReceiverWorker.java:120) 
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything) 
******************************************************************************** 
+0

你可以分享hornetQConnectionFactory配置嗎? – genjosanzo

+0

@genjosanzo補充感謝您檢查 –

+0

您是否有幾個Mule實例連接到同一個隊列? –

回答

6

首先要注意的一點是,騾使用JmsXRedeliveryHandler,這意味着它已經檢測到的HornetQ支持JMS_X_DELIVERY_COUNT報頭和將採取計數重新交付的護理。在這種情況下,騾完全依靠HornetQ提供準確的重新送貨計數。

引發此異常意味着JMS消息已呈現給Mule,且重傳次數超過JMS連接器上配置的計數(在您的情況下爲1)。

由於您在事務中使用,可能發生的情況是HornetQ會在每次重新啓動時一次又一次地回滾並將此消息表示爲Mule,除非您已在HornetQ本身上配置了最大重新傳送計數。

我的建議是:在Mule和HornetQ上設置相同的重新計算次數或在Mule上使用-1(無限制),並完全依靠HornetQ的重新交付限制。