Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How can messages appear out of order in non-transacational messages?

148 views
Skip to first unread message

MP

unread,
Jun 15, 2010, 3:40:43 PM6/15/10
to
There's a line in MSDN about transactional and non-transactional
messages (http://msdn.microsoft.com/en-us/library/ms706253(v=VS.
85).aspx) :

"Transactional messages guarantee exactly-once and in-order delivery.
Conversely, nontransactional messages cannot guarantee exactly-once or
in-order delivery."

Question 1: MSMQ is FIFO queue, then how would messages appear out or
order in case of non-transactional messages ?

Example: Client computer A sends non-transactional messages M1
followed by M2 to a queue Q deployed on Server B. Does this mean that
a process reading messages from Q may get M2 before M1? How is it
possible in case of FIFO queues like MSMQ?

Questions 2: Taking the same example as above, what would cause
duplicate messages to be added to the Q?

Thanks
MP

John Breakwell

unread,
Jun 17, 2010, 9:31:35 AM6/17/10
to
Hi,

MSMQ may well be FIFO for the queue but not necessarily for the queue
manager (QM) that receives messages to put in the queue. As the QM is
multi-threaded, there is a theoretical chance that one thread may complete
storing it's message in the queue before another thread (with a fractionally
earlier messages) does. There is a lot of code between a message arriving
over the wire and bring written into the queue. Maybe easier to see when
sending very large and very small messages to the same queue.
Also, transactional messages are only in order for the single transaction
that contains them. So you may see transactions out of order but not the
messages within the transaction. Example - if you send M1+M2 within T1 and
M3+M4 within T2 it is possible (from the discussion above) to have M1M2M3M4
or M3M4M1M2 but not M1M3M2M4.
Note that this is very unlikely under normal circumstances - not very heavy
load, for example.

Duplicate messages are covered here:
http://blogs.msdn.com/b/johnbreakwell/archive/2007/04/02/how-msmq-prevents-duplicate-messages.aspx

Cheers
John Breakwell

"MP" <mycom...@gmail.com> wrote in message
news:24d62ce7-f8d7-45a7...@b5g2000vbl.googlegroups.com...

0 new messages