2014-12-02 61 views
0

我只是試圖使用ActiveMQ隊列機制,而不是主題。下面的activemq.xml配置是否強制任何客戶端使用主題而不是隊列?我可以忽略policyEntry topic=">"?我看到有多個消費者有時(很小的比例)拿起相同的消息並處理它的問題。在管理控制檯中顯示我有一個隊列。我確實看到默認的activemq.xml包含主題和隊列的policyEntry。有點奇怪,如果這種配置對於基於隊列的方法確實無效,那麼並非所有的消息都被多個消費者線程使用。ActiveMQ主題policyEntry

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}" persistent="false"> 

     <destinationPolicy> 
      <policyMap> 
       <policyEntries> 
       <policyEntry topic=">" > 
        <!-- The constantPendingMessageLimitStrategy is used to prevent 
         slow topic consumers to block producers and affect other consumers 
         by limiting the number of messages that are retained 
         For more information, see: 

         http://activemq.apache.org/slow-consumer-handling.html 

        --> 
        <pendingMessageLimitStrategy> 
        <constantPendingMessageLimitStrategy limit="1000"/> 
        </pendingMessageLimitStrategy> 
       </policyEntry> 
       </policyEntries> 
      </policyMap> 
     </destinationPolicy> 

回答

1

你所指出的線只是意味着政策是爲所有主題定義,

在ActiveMQ中'>'做同樣的事情'*'支持其他語言即它是所有類型的默認處理程序。

如果您有疑問,您可以刪除該配置。

由於您的未決消息stratergy是在policyEntry中定義的,因此它將適用於所有主題,而不是隊列。