2016年7月21日星期四

ActiveMQ_040:Topic 消息分发策略


环境:MAC OS X 10.11.5 + ActiveMQ 5.13.3  

1. 平均分发消息:Round Robin Dispatch Policy

<destinationPolicy>
  <policyMap>
    <policyEntries>
      <policyEntry topic="FOO.>">
        <dispatchPolicy>
          <roundRobinDispatchPolicy />
        </dispatchPolicy>       
      </policyEntry>     
    </policyEntries>
  </policyMap>
</destinationPolicy>

2. 以相同顺序接收消息:Strict Order Dispatch Policy
保证每个 Topic 订阅者以相同的顺序接收消息,代价是性能上的损失。

<destinationPolicy>
  <policyMap>
    <policyEntries>
      <policyEntry topic="ORDERS.>">
        <dispatchPolicy>
          <strictOrderDispatchPolicy />
        </dispatchPolicy>
      </policyEntry>
      </policyEntries>
  </policyMap>
</destinationPolicy>

参考文献:
1. http://whitesock.iteye.com/blog/165458

没有评论: