views:

58

answers:

1

Considering MSMQ version 3.0

Hello.

I want to send and read messages from a remote MSMQ queue.

In version 3.0 remote reads with transactions are not supported. In version 4.0 transactional reads can be made not with receive method but with peek.

I saw a problem using transactional remote reads with MessageQueueTransaction and the answer suggest to use DTC transations. (TransactionScope)

http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.msmq.programming&tid=7dd22d35-1750-443d-a9b4-c771fde76e7b&cat=&lang=&cr=&sloc=&p=1

My question is if i can make transactional remote sends with MessageQueueTransaction object or, because it is a remote send, i need to use TransactionScope.

Thanks

A: 

According to [1], there are 2 kinds of transactions in MSMQ:
- Internal transactions - accomplished by MessageQueueTransaction object
- External transactions - accomplished by TransactionScope object.

We use external transactions when there are other participants then MSMQ (such as a data base) that needs to work all together in the same transacion.

Otherwise, if our transaction only includes MSMQ queues (even if more than one), we should use MessageQueueTransaction.

According to [2], msmq sends are done in "fire and forget" mode. In that case, independently of the queue being local or remote, if the transaction does not involve other participants, then a MessageQueueTransaction should be used.

In case of remote queues, if we need warranty that reaches destination, we have to use an acknowledgement mechanism.

[1] http://msdn.microsoft.com/en-us/library/ms978430.aspx
[2] http://beaucrawford.net/post/MSMQ-ndash3b-Sending-Messages-to-Remote-Queues.aspx

Zé Carlos