<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
<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