在哪里更改activemq中的预取值 [英] Where to change prefetch value in activemq

查看:147
本文介绍了在哪里更改activemq中的预取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了有关prefetch buffer的文档.据我的理解,如果我将Prefetch值= 1分配给使用者A.Activemq一次向A发送1条消息.一旦A向activemq发送了确认,则只有activemq将另一条消息推入给A的消息.

I read documentation about prefetch buffer.As per my understanding If I assign Prefetch value =1 to consumer A. Activemq push 1 message at a time to A .once A sends acknowledgement to activemq,then only activemq push another message to A.

我的疑问是,我需要为消费者分配预取值.

My doubt was,where I need to assign prefetch value to consumer.

我需要在消费者程序中分配预取值.如果正确,可以用简单的代码进行解释.

Am I need to assign prefetch value in consumer program.If it is right,can you explain with simple code.

谢谢.

推荐答案

根据 ActiveMQ手册:

ActiveMQ对可流式传输的邮件数量使用预取限制 任何时间的消费者.达到预取限制后, 直到消费者没有更多的消息被发送给消费者 开始发送回确认消息(以指示 消息已被处理).实际的预取限制值可以是 按每个消费者指定.

ActiveMQ uses a prefetch limit on how many messages can be streamed to a consumer at any point in time. Once the prefetch limit is reached, no more messages are dispatched to the consumer until the consumer starts sending back acknowledgements of messages (to indicate that the message has been processed). The actual prefetch limit value can be specified on a per consumer basis.

要更改所有使用者类型的预取大小,您将使用类似于以下内容的连接URI:

tcp://localhost:61616?jms.prefetchPolicy.all=50

要仅更改队列使用者类型的预取大小,请使用类似于以下内容的连接URI:

tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=1

还可以使用目标选项"针对每个消费者进行配置.

queue = new ActiveMQQueue("TEST.QUEUE?consumer.prefetchSize=10");
consumer = session.createConsumer(queue);

这篇关于在哪里更改activemq中的预取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆