2011-01-24 13 views
3

同じ宛先に2つのJMSメッセージを順次追加しています。これらのメッセージは両方とも、私が追加したのと同じ順序で受信されるか、または逆順になる機会があります。つまり、メッセージが最初に受信された宛先が最初に検索されます。JMSキューメッセージ受信順序

producer.send(Msg1); 
producer.send(Msg2); 
Msg1

Msg2はすべてのケースに順次追加される(ネットワーク障害や待ち時間等等。):

私は先に追加するのですか?

答えて

2
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. 

また

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. 

だからあなたの質問メッセージは、それらが上記の情報とともに送信されたのと同じ順序で受信されます答えるために。メッセージがサーバーに配信される順序は、メッセージ優先度、永続性/非永続性などの制限によって制限されます。