When you use AsA_Server, you indicate that you want long queues, and you will need to configure transactional queues.
When sending / receiving transactionally, MSMQ needs to be sent, transferred, received, and processed as part of a single transaction. However, in fact, all of these steps occur in their own transactions.
For example, a send transaction ends when the sender sends a message to his local MSMQ subsystem (even if the queue address is deleted, the sender still sends to the local queue, which acts as a kind of proxy for the remote queue).
Transmission is complete when the MSMQ subsystem on the sender machine successfully transmits a message to the MSMQ subsystem on the recipient machine.
Even if this can happen on one machine, I assume that your Handle () method writes to the database on another machine.
The problem is that for a transaction to succeed in terms of a transaction, your call to the database must be successful. Only after that the message will be disconnected from the input queue. This prevents the accidental loss of a message during processing failure.
However, in order to ensure that this function is performed over the network, you need to use DTC to coordinate the distributed transaction with the database.
Bottom line, if you want long queues in a distributed environment, then you will need to use MSDTC.
Hope this helps.
source share