Apache.NMS.ActiveMQ.TransactionContext.Begin C# (CSharp) Method

Begin() public method

public Begin ( ) : void
return void
        public void Begin()
        {
            if(!InTransaction)
            {
                this.transactionId = this.session.Connection.CreateLocalTransactionId();

                TransactionInfo info = new TransactionInfo();
                info.ConnectionId = this.session.Connection.ConnectionId;
                info.TransactionId = transactionId;
                info.Type = (int) TransactionType.Begin;

                this.session.Connection.Oneway(info);

                if(Tracer.IsDebugEnabled)
                {
                    Tracer.Debug("Begin:" + this.transactionId.ToString());
                }
            }
        }

Same methods

TransactionContext::Begin ( Transaction transaction ) : void

Usage Example

Example #1
0
        internal override void DoStartTransaction()
        {
            if (!TransactionContext.InNetTransaction)
            {
                if (Transaction.Current != null)
                {
                    Tracer.Debug("NetTxSession detected Ambient Transaction, start new TX with broker");

                    // Start a new .NET style transaction, this could be distributed
                    // or it could just be a Local transaction that could become
                    // distributed later.
                    TransactionContext.Begin(Transaction.Current);
                }
            }
        }
All Usage Examples Of Apache.NMS.ActiveMQ.TransactionContext::Begin