2014-12-02 63 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中定义的,因此它将适用于所有主题,而不是队列。