DMLC消息使用和确认 [英] DMLC message consumption and acknowledgement

查看:136
本文介绍了DMLC消息使用和确认的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我正在使用DMLC,我的并发使用者计数为1.预取限制为>1.我收到一条消息,并且该消息在执行侦听器之前得到确认.因此,在侦听器执行期间,代理具有更多消息,并根据预取设置将其发送给使用者.由于侦听器仍在执行,因此消费和确认将如何用于后续消息?

I am using DMLC and my concurrent consumers count is 1. The prefetch limit is > 1. I received a message and it is acknowledged before listener is executed. So, while the listener is executing, broker has more messages and it sends it to consumer as per prefetch settings. Since the listener is still executing, how will the consumption and acknowledgement works for subsequent messages?

是否会为所有新消息调用receive(),它们是否会得到确认并等待侦听器执行完成? [如果是这种情况,那么我很困惑为什么我的消费者统计信息中的消息计数未被确认] 或者 将调用receive(),但是直到前一个侦听器完成执行之前,下一条消息才会被确认? [如果由于其他原因导致我的侦听器执行被阻止,这可能会解释未确认的消息] 或者 引擎盖下发生了其他事情.

Will the receive() be called for all new messages and will they be acknowledged and wait for listener execution to complete? [If this is the case then I am confused why I am getting unacknowledgedmessagecount in consumer stats] OR The receive() will be called but next message will not be acknowledged until the previous listener has completed its execution? [this could potentially explain the unacknowledged messages if my listener execution is blocked due to some other reason] OR Something else happens under the hood.

有人可以解释一下吗?这将对我有很大帮助.

Can someone please explain this? It will help me a lot.

感谢和欢呼!

推荐答案

否.调用receive()以获得第一条消息;收到退货时被确认;然后,容器线程调用侦听器. (如果要回滚失败的传递-如果您的侦听器引发异常,则必须与DMLC一起使用事务.)

No. receive() is called to get the first message; it is acknowledged when receive returns; the container thread then invokes the listener. (You have to use transactions with the DMLC if you want to roll back a failed delivery - if your listener throws an exception).

任何预取的消息都由代理传递到客户端库,但是在处理上一条消息后,侦听器退出(onMessage())之前,Spring不会看到它们.即receive()MessageListener在同一线程上被调用.

Any prefetched messages are delivered by the broker to the client library, but they will not be seen by Spring until your listener exits (onMessage()) after processing the previous message. i.e. receive() is called on the same thread as the MessageListener.

Prefetch很好,因为下一条消息将立即用于下一条receive(),但是缺点是,如果您有多个使用者线程,并且侦听器有时可能需要很长时间来处理一条消息,则预取的消息可能会在其他线程空闲时坐在他的队列中.

Prefetch is good in that the next message will be immediately available for the next receive(), but the downside is, if you have multiple consumer threads and a listener can sometimes take a long time to process a message, prefetched messages can sit in his queue while other threads are idle.

这篇关于DMLC消息使用和确认的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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