MSMQ Basics- Transactional Messages Processing

1.Transactional message can be classified into internal transactional message and external transactional message
    i.internal message
        An internal transactional message si the simplest type of transaction. however, internal transactional message can not perform transactions with non-message queuing resources such as databases. if we wanna interact with a databas in a DB, we must use external transactional messages.  sending an internal transactional message is just like this:
            MessageQueueTransaction transaction=new MessageQueueTransction.
            MessageQueue mq=new MessageQueue(@".\transactonMQ",true);
            try    
            {
                    transaction.Begin();
                    mq.send("messae body1","label1",transaction);
                    mq.send("message body2","label2",transaction);
                    transaction.Commit();
                    //transaction principle: All or Nothing!
            }
            catch(Exception ex)
            {
                transaction.Abort();
             }

你可能感兴趣的:(transactional)