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();
             }

posted on 2008-04-09 16:06  飞天舞者  阅读(260)  评论(0编辑  收藏  举报

导航

For more information about me, feel free email to me winston.he@hotmail.com