一.消息目的地策略
在节点destinationPolicy配置策略,可以对单个或者所有的主题和队列进行设置,使用流量监控,当消息达到memoryLimit的时候,ActiveMQ会减慢消息的产生甚至阻塞,destinationPolicy的配置如下:
二.存储配置
producerFlowControl表示是否监控流量,默认为true,如果设置为false,消息就会存在磁盘中以防止内存溢 出;memoryLimit表示在producerFlowControl=”true”的情况下,消息存储在内存中最大量,当消息达到这个值 时,ActiveMQ会减慢消息的产生甚至阻塞。
队列分发策略如下:
propertydefaultdescription
useConsumerPriority
true
use the priority of a consumer when dispatching messages from a Queue
strictOrderDispatch
false
if true queue will not round robin consumers, but it'll use a single one until its prefetch buffer is full
optimizedDispatch
false
don't use a separate thread for dispatching from a Queue
lazyDispatch
false
only page in from store the number of messages that can be dispatched at time
consumersBeforeDispatchStarts
0
when the first consumer connects, wait for specified number of consumers before message dispatching starts
timeBeforeDispatchStarts
0
when the first consumer connects, wait for specified time (in ms) before message dispatching starts
queuePrefetch
n/a
sets the prefetch for consumers that are using the default value
expireMessagesPeriod
30000
the period (in ms) of checks for message expiry on queued messages, value of 0 disables
简单翻译如下:
useConsumerPriority:默认策略,按照用户优先级设置发送消息
strictOrderDispatchPolicy:保证每个topic consumer会以相同的顺序接收消息,代价是性能上的损失
当producer发送的持久化消息到达broker之后,broker首先会把它保存在持久存储中。接下来,如果发现当前有活跃的 consumer,如果这个consumer消费消息的速度能跟上producer生产消息的速度,那么Acti