2012-10-11 57 views

回答

2

排序取消息你想要做什麼是真正的resequencer enterprise integration pattern

您可以使用與ActiveMQ捆綁在一起的Apache Camel來實現。

您需要做的是將以下內容添加到ActiveMQ中的'camel.xml'配置文件中。

<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> 
    <route> 
    <from uri="activemq:queue:unordered"/> 
    <resequence> 
     <simple>in.header.orderno</simple> 
     <to uri="activemq:queue:ordered" /> 
     <stream-config capacity="5000" timeout="4000"/> 
    </resequence> 
    </route> 
</camelContext> 

然後,只需確保文件包含您的ActiveMQ的配置裏面,比如activemq.xml中:

<import resource="camel.xml"/> 

注意,該安裝程序會以任何順序從「無序」隊列中讀取消息,而你的應用程序應該讀取從「有序」隊列重新排序。

相關問題