TransactionScope rises to MSDTC when sending between queues?

I have a simple process that reads from one queue, processes messages, and outputs to another. I am trying to wrap this transfer in TransactionScope so that both reading from the input queue and writing to the output queue occur within the same transaction.

However, it seems that MSDTC is used to conduct this transaction, and as a result, it is significantly slower than using the standard MessageQueueTransaction. Should this happen? I got the impression that TransactionScope would only raise to an external transaction if an area is involved, for example, reading a message queue and writing to the database, but not only if there are several message queues.

Thank.

EDIT: At the moment, all this is on my laptop, so I am sure that other machines are not involved.

I also want to add that I confirm that the transaction is escalating by checking the Windows Component Services snap-in (that is, the local DTC / transaction list). I see transactions entering and leaving this screen, which, I believe, means that the transaction has escalated. Am I really wrong about that?

EDIT 2: I get the same behavior when I just write in one queue! i.e.

using (var ts = new TransactionScope())
{
    using (var q = new MessageQueue("..."))
    {
        /* write data */
    }

    ts.Complete();
}

I see that DTC is used with the above, even though the queue is on the local machine.

+5
source share
3 answers

, TransactionScope . MessageQueueTransaction, , . - SQL, , , .

+3

MSDN:

, ( ):

( ) , System.Transactions , Microsoft (MSDTC). , . , .

, , - , . (, , MS SQL Windows () .)

, WCF.

0

, TransactionScope .

This statement is not true. TransactionScope will process local transactions in message queues, it just uses MSDTC for this.

0
source

All Articles