JMS队列消息接收顺序
我按顺序在同一目标中添加两条 JMS 消息。这两条消息的接收顺序是否与我添加它们的顺序相同,或者是否有可能进行相反的排序,即首先检索目的地中首先接收到的消息。
我添加到目的地的方式是:
producer.send(Msg1);
producer.send(Msg2);
Msg1
和 Msg2
将在所有情况下按顺序添加(例如网络故障和延迟等)?
I am adding two JMS messages in the same destination sequentially. Will both of these messages be received in the same order in which I have added them or is there a chance for reverse ordering, that is, which ever the message is received first in the destination will be retrieved first.
I am adding into a destination as:
producer.send(Msg1);
producer.send(Msg2);
Msg1
and Msg2
will be added sequentially in all the cases (like network failures and latency. etc.)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不保证消息排序(且规范未强制要求)和总计JMS 消息排序详细解释了原因。另请参阅 StackOverflow 帖子如何处理消息顺序在 JMS 中?。
Message ordering is not guaranteed (and not mandated by the specification) and Total JMS Message ordering explains the details of why. Also see the Stack Overflow post How to handle order of messages in JMS?.
根据 JMS2 规范
,
为了回答您的问题,消息将按照与上述信息一起发送的顺序接收。然而,消息传递到服务器的顺序将受到消息优先级、持久/非持久等限制的约束。
As per JMS2 specs
Also
So to answer your question messages will be received in the same order they were sent with above information. The order in which messages are delivered to the server however will be constrained by limitations like message priority, persistent/non persistent etc.