Producer Flow Control

<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry topic=">" producerFlowControl="true" memoryLimit="1mb">
<pendingSubscriberPolicy>
<vmCursor/>
</pendingSubscriberPolicy>
</policyEntry>
<policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb">
<!-- Use VM cursor for better latency
For more information, see:

http://activemq.apache.org/message-cursors.html

<pendingQueuePolicy>
<vmQueueCursor/>
</pendingQueuePolicy>
-->
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>

desitination配置:
我们目前只使用queue,没有使用topic,所以只有queue policy的设置。activemq可以针对
每个queue进行单独设置,这里“>”是通配符,表示所有queue,具体到生产环境中,需要
针对每个queue进行设置。
这里memoryLimit="100mb"表示queue的内存限制为100M,producerFlowControl="false"表示关闭流量控
制,如果不关闭流量控制,在消息量发生累积时,amq会主动控制流量,减少消息的生产。

Starting with version 5.0 of ActiveMQ, you can control the flow of asynchronous sends. In other words, you can control the maximum amount of message data that an asynchronous producer can transmit to the message broker prior to receiving an acknowledgment from the broker that it has accepted the previously sent messages. By default, this flow control is disabled for producers that have enabled asynchronous sends; however, you can enable flow control for asynchronous sends by assigning the ‘producerWindowSize’ property to the asynchronous producer’s connector URI as depicted in this example.

tcp://localhost:61616jms.useAsyncSend=true&jms.producerWindowSize=1024000
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值