我在相同的目标中按顺序添加两个JMS消息。这些消息是否会按照我添加它们的相同顺序接收,或者是否有反向排序的机会,也就是说,首先会在目标中先收到哪个消息。JMS队列消息接收订单
我加入到目的地为:
producer.send(Msg1);
producer.send(Msg2);
Msg1
和Msg2
将按顺序在所有情况下被添加(如网络故障和延迟等)?
我在相同的目标中按顺序添加两个JMS消息。这些消息是否会按照我添加它们的相同顺序接收,或者是否有反向排序的机会,也就是说,首先会在目标中先收到哪个消息。JMS队列消息接收订单
我加入到目的地为:
producer.send(Msg1);
producer.send(Msg2);
Msg1
和Msg2
将按顺序在所有情况下被添加(如网络故障和延迟等)?
邮件订购不保证(并且不是规范要求的)并且Total JMS Message ordering解释了原因的细节。另请参阅堆栈 溢出帖子How to handle order of messages in JMS?。
按照同样
Although clients loosely view the messages they produce within a session
as forming a serial stream of sent messages, the total ordering of this stream
is not significant. The only ordering that is visible to receiving clients is
the order of messages a session sends to a particular destination.
Several things can affect this order like message priority,
persistent/non persistent etc.
因此,要回答你的问题的消息将在它们上面的信息被发送的顺序接收JMS2规格
JMS defines that messages sent by a session to a destination must be received
in the order in which they were sent. This defines a partial ordering
constraint on a session’s input message stream.
JMS does not define order of message receipt across destinations or across
a destination’s messages sent from multiple sessions. This aspect of a
session’s input message stream order is timing-dependent. It is not under
application control.
。然而,将消息传递到服务器的顺序将受限于诸如消息优先级,持久性/非持久性等限制。