客户端可以在确认之前接收队列的多条消息吗? [英] Can client receive multiple messages of the queue before acknowledging them?

查看:22
本文介绍了客户端可以在确认之前接收队列的多条消息吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的程序接收消息的速度会很慢;我希望他们坚持排队,直到我收到所有这些并确认所有这些.我不知道我是否有足够的消息,直到我收到一堆消息.

My program will be receiving messages rather slowly; and I want to them to persist in the queue until I have receive all of them and acknowledge all of them. I don't know if I have enough messages until I receive a bunch of them.

我的问题:队列是否会阻塞,在传递第二条消息之前等待第一条消息的确认?

My question: will the queue block, waiting for the acknowledgement from the first message before delivering the second?

推荐答案

当将确认模式设置为 Session.CLIENT_ACKNOWLEDGE 时,您可以获得所需数量的消息.消息将被锁定在服务器上,因此其他消费者无法同时检索它们.所以答案是否定的,队列不会阻塞(即使可能有特定于提供者的设置可以做到这一点,我不知道).

When setting the acknowledge mode to Session.CLIENT_ACKNOWLEDGE you can get as many messages you need. The messages will be locked on the server, so no other consumer can retrieve them meanwhile. So the answer is no, the queue won't block (even thu there might be provider-specific settings that can do that, which I don't know).

但是,您只能一次性全部确认.因此,当您收到 10 条消息,并且您确认其中一条(无论哪个)时,所有消息都将被确认.

However, you can acknowledge only all at once. So when you have received 10 messages, and you acknowledge one of them (doesn't matter which), all messages will be acknowledged.

检查您的参考控制消息确认

这篇关于客户端可以在确认之前接收队列的多条消息吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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