Dispatch policies for queues
Plug-able dispatch policies only apply to topics. For Queues, dispatch is more static, you can choose round robin (the default) or strict order. Before discussing dispatch policies its worth first understanding the purpose of the prefetch value.
The out of the box configuration of ActiveMQ is designed for high performance and high throughput messaging where there are lots of messages that need to be dispatched to consumers as quickly as possible. So the default prefetch values are fairly large and the default dispatch policy will try and fill the prefetch buffers as quickly as possible.
However with messaging there are many use cases and sometimes the default configuration is not ideal to your use case; when you send a small number of messages, they tend to all go to one consumer unless you've lots of messages. If you have a large number of consumers and a relatively high prefetch value and you have a small number of messages that each message takes quite a while to process then the default dispatch policy might result in increasing the amount of time it takes to process all the messages (since the load balancing is not fair for small numbers of messages).
For queues, you can define whether the dispatch will occur in a round-robin fashion (default behavior) or if one consumer's prefetch buffer will be exhausted before the dispatch process selects the next consumer along (strictOrderDispatch).
Consumer priorities are observed, so if you have several consumers with different priorities, the one with the highest priority will be flooded first until it can take no more, then the next one along, etc
Dispatch policies for Topics
There are more options for topics because the dispatch policy is plug-able. Any implementation of org.apache.activemq.broker.region.policy.DispatchPolicy will work.
Here is an example of destination policy configuration.
Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20