ACTIVEMQ設置預取消息數目
當ACTIVEMQ的某個QUEUE有多個消費者,為避免某個消息者取了更多個消息處理,而造成其他消費者無消息可處理的情況,可以設置每個消費者不預取消息,即每個消費者消費完單個消息后,再去取消息,這樣其他消費者就能平均的有消息可處理。https://stackoverflow.com/questions/35928089/activemq-how-to-prevent-message-from-going-to-dispatched-queue
設置方法,在CONNECT STRING中設置:
tcp://localhost:61616?jms.prefetchPolicy.all=0
tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=0
queue = new ActiveMQQueue("TEST.QUEUE?consumer.prefetchSize=10");
consumer = session.createConsumer(queue);
tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=0
queue = new ActiveMQQueue("TEST.QUEUE?consumer.prefetchSize=10");
consumer = session.createConsumer(queue);
http://activemq.apache.org/what-is-the-prefetch-limit-for.html
posted on 2019-10-31 11:28 paulwong 閱讀(833) 評論(0) 編輯 收藏 所屬分類: JMS