private void Enlist(Transaction transaction)
        {
            if (transaction == null)
            {
                // no enlistment as we are not in a TransactionScope
                return;
            }

            // try to enlist as a PSPE
            if (!transaction.EnlistPromotableSinglePhase(this))
            {
                // our enlistmente fail so we need to enlist ourselves as durable.

                // we create a transaction directly instead of using BeginTransaction that GraphClient
                // doesn't store it in its stack of scopes.
                var localTransaction = new Neo4jTransaction(_client);
                localTransaction.ForceKeepAlive();
                _transactionId = localTransaction.Id;
                var resourceManager  = GetResourceManager();
                var propagationToken = TransactionInterop.GetTransmitterPropagationToken(transaction);
                var transactionExecutionEnvironment = new TransactionExecutionEnvironment(_client.ExecutionConfiguration)
                {
                    TransactionId           = localTransaction.Id,
                    TransactionBaseEndpoint = _client.TransactionEndpoint
                };
                resourceManager.Enlist(transactionExecutionEnvironment, propagationToken);
                localTransaction.Cancel();
            }

            _enlistedInTransactions.Add(transaction);
        }
Example #2
0
        private void Enlist(Transaction transaction)
        {
            if (transaction == null)
            {
                // no enlistment as we are not in a TransactionScope
                return;
            }

            // try to enlist as a PSPE
            if (!transaction.EnlistPromotableSinglePhase(this))
            {
                // our enlistmente fail so we need to enlist ourselves as durable.

                // we create a transaction directly instead of using BeginTransaction that GraphClient
                // doesn't store it in its stack of scopes.
                var localTransaction = new BoltNeo4jTransaction(((BoltGraphClient)client).Driver);


                var propagationToken = TransactionInterop.GetTransmitterPropagationToken(transaction);
                var transactionExecutionEnvironment = new BoltTransactionExecutionEnvironment(client.ExecutionConfiguration)
                {
                    Session           = this.transaction.Session,
                    DriverTransaction = this.transaction.DriverTransaction,
                    TransactionId     = this.transactionId
                                        //                    TransactionId = localTransaction.Id,
                                        //                    TransactionBaseEndpoint = client.TransactionEndpoint
                };
                ResourceManager.Enlist(transactionExecutionEnvironment, propagationToken);
                localTransaction.Cancel();
            }

            enlistedInTransactions.Add(transaction);
        }
Example #3
0
        static byte[] CreateFixedPropagationToken()
        {
            if (fixedPropagationToken == null)
            {
                CommittableTransaction tx = new CommittableTransaction();
                byte[] token = TransactionInterop.GetTransmitterPropagationToken(tx);

                // Don't abort the transaction. People notice this and do not like it.
                try
                {
                    tx.Commit();
                }
                catch (TransactionException e)
                {
                    DiagnosticUtility.TraceHandledException(e, TraceEventType.Information);
                }

                Interlocked.CompareExchange <byte[]>(ref fixedPropagationToken, token, null);
            }

            byte[] tokenCopy = new byte[fixedPropagationToken.Length];
            Array.Copy(fixedPropagationToken, tokenCopy, fixedPropagationToken.Length);

            return(tokenCopy);
        }
Example #4
0
        public byte[] Promote()
        {
#pragma warning disable PC001
            return(TransactionInterop.GetTransmitterPropagationToken(new CommittableTransaction()));

#pragma warning restore PC001
        }
 public static void AddTransactionToken(this HttpClient client)
 {
     if (Transaction.Current != null)
     {
         var token = TransactionInterop.GetTransmitterPropagationToken(Transaction.Current);
         client.DefaultRequestHeaders.Add("TransactionToken", Convert.ToBase64String(token));
     }
 }
Example #6
0
 public static void AddTransactionPropagationToken(this HttpRequestMessage request)
 {
     if (Transaction.Current != null)
     {
         var token = TransactionInterop.GetTransmitterPropagationToken(Transaction.Current);
         request.Headers.Add("TransactionToken", Convert.ToBase64String(token));
     }
 }
Example #7
0
        //=======================================================================================
        void ForcePromotion(Transaction transaction)
        {
            // Force promotion. This may throw TransactionException.
            // We used to check the DistributedIdentifier property first, but VSWhidbey



            TransactionInterop.GetTransmitterPropagationToken(transaction);
        }
 //=======================================================================================
 void ForcePromotion(Transaction transaction)
 {
     // Force promotion. This may throw TransactionException.
     // We used to check the DistributedIdentifier property first, but VSWhidbey bug 547901
     // prevents us from doing so reliably in multi-threaded scenarios (there is a ----
     // in the System.Transactions code that can cause a NullReferenceException if we ask
     // for the identifier while the transaction is being promoted)
     TransactionInterop.GetTransmitterPropagationToken(transaction);
 }
Example #9
0
        public byte[] Promote(INpgsqlTransactionCallbacks callbacks)
        {
            CommittableTransaction tx = new CommittableTransaction();
            DurableResourceManager rm = new DurableResourceManager(this, callbacks, tx);

            byte[] token = TransactionInterop.GetTransmitterPropagationToken(tx);
            _transactions.Add(rm.TxName, tx);
            rm.Enlist(tx);
            return(token);
        }
Example #10
0
        private static TransactionScope CreateDistributedTransactionScope()
        {
            var scope = new TransactionScope();

            //
            // Forces promotion to distributed transaction
            //
            TransactionInterop.GetTransmitterPropagationToken(System.Transactions.Transaction.Current);
            return(scope);
        }
Example #11
0
        public void MarshalAsCoordinationContext(Transaction transaction, out CoordinationContext context, out RequestSecurityTokenResponse issuedToken)
        {
            uint                    num;
            IsolationFlags          flags;
            string                  str2;
            WsatExtendedInformation information;
            string                  str3;
            Guid                    distributedIdentifier = transaction.TransactionInformation.DistributedIdentifier;
            string                  contextId             = null;

            context = new CoordinationContext(this.protocolVersion);
            OleTxTransactionFormatter.GetTransactionAttributes(transaction, out num, out flags, out str2);
            context.IsolationFlags = flags;
            context.Description    = str2;
            if (TransactionCache <Transaction, WsatExtendedInformation> .Find(transaction, out information))
            {
                context.Expires = information.Timeout;
                if (!string.IsNullOrEmpty(information.Identifier))
                {
                    context.Identifier = information.Identifier;
                    contextId          = information.Identifier;
                }
            }
            else
            {
                context.Expires = num;
                if (context.Expires == 0)
                {
                    context.Expires = (uint)TimeoutHelper.ToMilliseconds(this.wsatConfig.MaxTimeout);
                }
            }
            if (context.Identifier == null)
            {
                context.Identifier = CoordinationContext.CreateNativeIdentifier(distributedIdentifier);
                contextId          = null;
            }
            if (!this.wsatConfig.IssuedTokensEnabled)
            {
                str3        = null;
                issuedToken = null;
            }
            else
            {
                CoordinationServiceSecurity.CreateIssuedToken(distributedIdentifier, context.Identifier, this.protocolVersion, out issuedToken, out str3);
            }
            AddressHeader refParam = new WsatRegistrationHeader(distributedIdentifier, contextId, str3);

            context.RegistrationService = this.wsatConfig.CreateRegistrationService(refParam, this.protocolVersion);
            context.IsolationLevel      = transaction.IsolationLevel;
            context.LocalTransactionId  = distributedIdentifier;
            if (this.wsatConfig.OleTxUpgradeEnabled)
            {
                context.PropagationToken = TransactionInterop.GetTransmitterPropagationToken(transaction);
            }
        }
Example #12
0
        public byte[] PromoteTransaction(Guid fromTxId)
        {
            var committableTransaction      = new CommittableTransaction();
            var transmitterPropagationToken = TransactionInterop.GetTransmitterPropagationToken(committableTransaction);

            TransactionalStorage.Batch(
                actions =>
                actions.Transactions.ModifyTransactionId(fromTxId, committableTransaction.TransactionInformation.DistributedIdentifier,
                                                         TransactionManager.DefaultTimeout));
            return(transmitterPropagationToken);
        }
Example #13
0
        public byte[] Promote(ITransactionExecutionEnvironment transactionExecutionEnvironment)
        {
            var promotedTx = new CommittableTransaction();
            var neo4jTransactionHandler = new Neo4jTransationSinglePhaseNotification(transactionExecutionEnvironment);
            var token = TransactionInterop.GetTransmitterPropagationToken(promotedTx);

            transactions[transactionExecutionEnvironment.TransactionId] = promotedTx;
            neo4jTransactionHandler.Enlist(promotedTx);

            return(token);
        }
        public static string AddTransactionPropagationToken(this HttpRequestMessage request)
        {
            string token = null;

            if (Transaction.Current != null)
            {
                var tokenBytes = TransactionInterop.GetTransmitterPropagationToken(Transaction.Current);
                token = Convert.ToBase64String(tokenBytes);
                request.Headers.Add("TransactionToken", token);
            }
            return(token);
        }
        public override void WriteTransaction(Transaction transaction, Message message)
        {
            WsatExtendedInformation information;

            byte[] transmitterPropagationToken = TransactionInterop.GetTransmitterPropagationToken(transaction);
            if (!TransactionCache <Transaction, WsatExtendedInformation> .Find(transaction, out information))
            {
                uint timeoutFromTransaction = GetTimeoutFromTransaction(transaction);
                information = (timeoutFromTransaction != 0) ? new WsatExtendedInformation(null, timeoutFromTransaction) : null;
            }
            OleTxTransactionHeader header = new OleTxTransactionHeader(transmitterPropagationToken, information);

            message.Headers.Add(header);
        }
Example #16
0
    private static void Main()
    {
        string      connString  = "data source=.;initial catalog=Test;integrated security=True;persist security info=True";
        string      tokenFile   = @"c:\Temp\token.txt";
        Transaction transaction = null;
        bool        isChild     = false;

        if (File.Exists(tokenFile))
        {
            isChild = true;
            string tokenString = File.ReadAllText(tokenFile);
            byte[] token       = Convert.FromBase64String(tokenString);
            transaction = TransactionInterop.GetTransactionFromTransmitterPropagationToken(token);
        }
        using (var parentTxCompleteEvent = new ManualResetEventSlim(!isChild))
        {
            using (var transactionScope = transaction != null ? new TransactionScope(transaction) : new TransactionScope(TransactionScopeOption.Required, new TimeSpan(0, 15, 0)))
            {
                var curr = Transaction.Current;
                if (!isChild)
                {
                    byte[] transactionBytes = TransactionInterop.GetTransmitterPropagationToken(curr);
                    string tokenString      = Convert.ToBase64String(transactionBytes);
                    File.WriteAllText(tokenFile, tokenString);
                }
                else
                {
                    transaction.TransactionCompleted += (sender, e) => parentTxCompleteEvent.Set();
                }
                using (var conn = new SqlConnection(connString))
                {
                    conn.Open();
                    using (SqlCommand cmd = conn.CreateCommand())
                    {
                        Console.WriteLine("Enter id and value");
                        cmd.CommandText = "INSERT INTO KeyValue(Id, Value) VALUES (@1, @2)";
                        cmd.Parameters.Add(new SqlParameter("@1", Console.ReadLine()));
                        cmd.Parameters.Add(new SqlParameter("@2", Console.ReadLine()));
                        cmd.ExecuteNonQuery();
                    }
                }
                transactionScope.Complete();
                Console.WriteLine("Dispose");
                Console.ReadLine();
            }
            parentTxCompleteEvent.Wait();
        }
    }
Example #17
0
        /// <summary>
        /// Notifies this object that an escalation of the delegated transaction has been requested.
        /// </summary>
        /// <returns>
        /// A transmitter/receiver propagation token that marshals a distributed transaction.
        /// </returns>
        /// <seealso cref="TransactionInterop.GetTransactionFromTransmitterPropagationToken(System.Byte[])"/>
        byte[] ITransactionPromoter.Promote()
        {
            try
            {                
                m_ctx = new CommittableTransaction();                
                m_ctx.EnlistDurable(this.Rmid, this, EnlistmentOptions.None);
                
                byte[] propagationToken = TransactionInterop.GetTransmitterPropagationToken(m_ctx);

                return propagationToken;
            }
            catch (Exception ex)
            {                
                throw ex;
            }
        }
        public override void WriteTransaction(Transaction transaction, Message message)
        {
            byte[] propToken = TransactionInterop.GetTransmitterPropagationToken(transaction);

            // Find or compute extended information for the transaction
            WsatExtendedInformation info;

            if (!WsatExtendedInformationCache.Find(transaction, out info))
            {
                uint timeout = GetTimeoutFromTransaction(transaction);
                info = (timeout != 0) ? new WsatExtendedInformation(null, timeout) : null;
            }

            OleTxTransactionHeader header = new OleTxTransactionHeader(propToken, info);

            message.Headers.Add(header);
        }
 void ValidateIfDtcIsAvailable()
 {
     if (TransportTransactionMode == TransportTransactionMode.TransactionScope)
     {
         try
         {
             using (var ts = new TransactionScope())
             {
                 TransactionInterop.GetTransmitterPropagationToken(Transaction.Current); // Enforce promotion to MSDTC
                 ts.Complete();
             }
         }
         catch (TransactionAbortedException)
         {
             throw new Exception("Transaction mode is set to `TransactionScope`. This depends on Microsoft Distributed Transaction Coordinator (MSDTC) which is not available. Either enable MSDTC, enable Outbox, or lower the transaction mode to `SendsAtomicWithReceive`.");
         }
     }
 }
Example #20
0
        public static T WithTransaction <T>(Func <T> func,
                                            TimeSpan?timeout = null,
                                            IsolationLevel isolationLevel = IsolationLevel.ReadCommitted,
                                            bool enableMultiThreadSupportForTransaction = false)
        {
            using var scope = CreateTransactionScope(timeout, isolationLevel,
                                                     enableMultiThreadSupportForTransaction
                    ? TransactionScopeAsyncFlowOption.Enabled
                    : TransactionScopeAsyncFlowOption.Suppress);
            if (enableMultiThreadSupportForTransaction)
            {
                TransactionInterop.GetTransmitterPropagationToken(Transaction.Current);
            }

            var result = func();

            scope.Complete();
            return(result);
        }
 private static byte[] CreateFixedPropagationToken()
 {
     if (fixedPropagationToken == null)
     {
         CommittableTransaction transaction = new CommittableTransaction();
         byte[] transmitterPropagationToken = TransactionInterop.GetTransmitterPropagationToken(transaction);
         try
         {
             transaction.Commit();
         }
         catch (TransactionException exception)
         {
             DiagnosticUtility.ExceptionUtility.TraceHandledException(exception, TraceEventType.Information);
         }
         Interlocked.CompareExchange <byte[]>(ref fixedPropagationToken, transmitterPropagationToken, null);
     }
     byte[] destinationArray = new byte[fixedPropagationToken.Length];
     Array.Copy(fixedPropagationToken, destinationArray, fixedPropagationToken.Length);
     return(destinationArray);
 }
        public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
        {
            // obtain the tx propagation token
            byte[] propToken = null;
            if (Transaction.Current != null && IsTxFlowRequiredForThisOperation(request.Headers.Action))
            {
                try
                {
                    propToken = TransactionInterop.GetTransmitterPropagationToken(Transaction.Current);
                }
                catch (TransactionException e)
                {
                    throw new CommunicationException("TransactionInterop.GetTransmitterPropagationToken failed.", e);
                }
            }

            // set the propToken on the message in a TransactionFlowProperty
            TransactionFlowProperty.Set(propToken, request);

            return(null);
        }
Example #23
0
 public void Enlist(Transaction tx)
 {
     if (tx != null)
     {
         _isolationLevel = tx.IsolationLevel;
         if (!tx.EnlistPromotableSinglePhase(this))
         {
             // must already have a durable resource
             // start transaction
             _npgsqlTx      = _connection.BeginTransaction(ConvertIsolationLevel(_isolationLevel));
             _inTransaction = true;
             _rm            = CreateResourceManager();
             _callbacks     = new NpgsqlTransactionCallbacks(_connection);
             _rm.Enlist(_callbacks, TransactionInterop.GetTransmitterPropagationToken(tx));
             // enlisted in distributed transaction
             // disconnect and cleanup local transaction
             _npgsqlTx.Cancel();
             _npgsqlTx.Dispose();
             _npgsqlTx = null;
         }
     }
 }
        private static void MedicalDTC()
        {
            using (TransactionScope scope = new TransactionScope())
            {
                var token = TransactionInterop.GetTransmitterPropagationToken(Transaction.Current);
                MedicalContext.MedicalContext medicalContext = new MedicalContext.MedicalContext();
                medicalContext.Student.Add(new MedicalContext.Student()
                {
                    Name = "student from medical "
                });

                string sessionToken  = GetSessionTokenFromAdo();
                string sessionToken2 = GetSessionTokenFromDbContext(medicalContext);

                medicalContext.SaveChanges();

                CallingBackOffice(sessionToken2);
                scope.Complete();
            }

            var x = "";
        }
 public void GetObjectData(SerializationInfo serializationInfo, StreamingContext context)
 {
     if (serializationInfo == null)
     {
         throw new ArgumentNullException("serializationInfo");
     }
     byte[] transmitterPropagationToken = null;
     if (DiagnosticTrace.Verbose)
     {
         MethodEnteredTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "OletxTransaction.GetObjectData");
     }
     transmitterPropagationToken = TransactionInterop.GetTransmitterPropagationToken(this);
     serializationInfo.SetType(typeof(OletxTransaction));
     serializationInfo.AddValue("OletxTransactionPropagationToken", transmitterPropagationToken);
     if (DiagnosticTrace.Information)
     {
         TransactionSerializedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), this.TransactionTraceId);
     }
     if (DiagnosticTrace.Verbose)
     {
         MethodExitedTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), "OletxTransaction.GetObjectData");
     }
 }
 public byte[] Promote()
 {
     _notOnlyLocalEffects = true;
     WriteResources();
     return(TransactionInterop.GetTransmitterPropagationToken(Transaction.Current));
 }
Example #27
0
        //=======================================================================================
        // The demand is not added now (in 4.5), to avoid a breaking change. To be considered in the next version.

        /*
         * // We demand full trust because we use CoordinationContext and CoordinationServiceSecurity from a non-APTCA assembly.
         * // The CoordinationContext constructor can call Environment.FailFast and it's recommended to not let partially trusted callers to bring down the process.
         * // WSATs are not supported in partial trust, so customers should not be broken by this demand.
         * [PermissionSet(SecurityAction.Demand, Unrestricted = true)]
         */
        public void MarshalAsCoordinationContext(Transaction transaction,
                                                 out CoordinationContext context,
                                                 out RequestSecurityTokenResponse issuedToken)
        {
            Guid   transactionId      = transaction.TransactionInformation.DistributedIdentifier;
            string nonNativeContextId = null;

            context = new CoordinationContext(this.protocolVersion);

            // Get timeout, description and isolation flags
            uint           timeout;
            IsolationFlags isoFlags;
            string         description;

            OleTxTransactionFormatter.GetTransactionAttributes(transaction,
                                                               out timeout,
                                                               out isoFlags,
                                                               out description);
            context.IsolationFlags = isoFlags;
            context.Description    = description;

            // If we can, use cached extended information
            // Note - it may be worth using outgoing contexts more than once.
            // We'll let performance profiling decide that question
            WsatExtendedInformation info;

            if (WsatExtendedInformationCache.Find(transaction, out info))
            {
                context.Expires = info.Timeout;

                // The extended info cache only contains an identifier when it's non-native
                if (!string.IsNullOrEmpty(info.Identifier))
                {
                    context.Identifier = info.Identifier;
                    nonNativeContextId = info.Identifier;
                }
            }
            else
            {
                context.Expires = timeout;
                if (context.Expires == 0)
                {
                    // If the timeout is zero, there are two possibilities:
                    // 1) This is a root transaction with an infinite timeout.
                    // 2) This is a subordinate transaction whose timeout was not flowed.
                    // We have no mechanism for distinguishing between the two cases.
                    //
                    // We could always return zero here, instead of using the local max timeout.
                    // The problem is that the 2004/08 WS-C spec does not specify the meaning
                    // of a zero expires field. While we accept zero to mean "as large as possible"
                    // it would be risky to expect others to do the same.  So we only propagate
                    // zero in the expires field if the local max timeout has been disabled.
                    //
                    // This is MB 34596: how can we flow the real timeout?
                    context.Expires = (uint)TimeoutHelper.ToMilliseconds(this.wsatConfig.MaxTimeout);
                }
            }

            if (context.Identifier == null)
            {
                context.Identifier = CoordinationContext.CreateNativeIdentifier(transactionId);
                nonNativeContextId = null;
            }

            string tokenId;

            if (!this.wsatConfig.IssuedTokensEnabled)
            {
                tokenId     = null;
                issuedToken = null;
            }
            else
            {
                CoordinationServiceSecurity.CreateIssuedToken(transactionId,
                                                              context.Identifier,
                                                              this.protocolVersion,
                                                              out issuedToken,
                                                              out tokenId);
            }

            AddressHeader refParam = new WsatRegistrationHeader(transactionId, nonNativeContextId, tokenId);

            context.RegistrationService = wsatConfig.CreateRegistrationService(refParam, this.protocolVersion);
            context.IsolationLevel      = transaction.IsolationLevel;
            context.LocalTransactionId  = transactionId;

            if (this.wsatConfig.OleTxUpgradeEnabled)
            {
                context.PropagationToken = TransactionInterop.GetTransmitterPropagationToken(transaction);
            }
        }
 public byte[] Promote()
 {
     return(TransactionInterop.GetTransmitterPropagationToken(new CommittableTransaction()));
 }
Example #29
0
 protected override void Execute(CodeActivityContext context)
 {
     TransactionInterop.GetTransmitterPropagationToken(System.Transactions.Transaction.Current);
 }
        /// <summary>
        /// Does the receive and execute using TxPlatformTransactionManager.  Starts a distributed
        /// transaction before calling Receive.
        /// </summary>
        /// <param name="mq">The message queue.</param>
        /// <param name="status">The transactional status.</param>
        /// <returns>
        /// true if should continue peeking, false otherwise.
        /// </returns>
        protected override bool DoReceiveAndExecuteUsingPlatformTransactionManager(MessageQueue mq,
                                                                                   ITransactionStatus status)
        {
            #region Logging

            if (LOG.IsDebugEnabled)
            {
                LOG.Debug("Executing DoReceiveAndExecuteUsingTxScopeTransactionManager");
            }

            #endregion Logging

            //We are sure to be talking to a second resource manager, so avoid going through
            //the promotable transaction and force a distributed transaction right from the start.
            TransactionInterop.GetTransmitterPropagationToken(System.Transactions.Transaction.Current);

            Message message;
            try
            {
                message = mq.Receive(TimeSpan.Zero, MessageQueueTransactionType.Automatic);
            }
            catch (MessageQueueException ex)
            {
                if (ex.MessageQueueErrorCode == MessageQueueErrorCode.IOTimeout)
                {
                    //expected to occur occasionally

                    #region Logging

                    if (LOG.IsTraceEnabled)
                    {
                        LOG.Trace(
                            "MessageQueueErrorCode.IOTimeout: No message available to receive.  May have been processed by another thread.");
                    }

                    #endregion

                    status.SetRollbackOnly();
                    return(false); // no more peeking unless this is the last listener thread
                }
                else
                {
                    // A real issue in receiving the message
                    lock (messageQueueMonitor)
                    {
                        mq.Close();
                        MessageQueue.ClearConnectionCache();
                    }
                    throw; // will cause rollback in surrounding platform transaction manager and log exception
                }
            }

            if (message == null)
            {
                #region Logging

                if (LOG.IsTraceEnabled)
                {
                    LOG.Trace("Message recieved is null from Queue = [" + mq.Path + "]");
                }

                #endregion

                status.SetRollbackOnly();
                return(false); // no more peeking unless this is the last listener thread
            }


            try
            {
                #region Logging

                if (LOG.IsDebugEnabled)
                {
                    LOG.Debug("Received message [" + message.Id + "] on queue [" + mq.Path + "]");
                }

                #endregion

                MessageReceived(message);
                if (DistributedTransactionExceptionHandler != null)
                {
                    if (DistributedTransactionExceptionHandler.IsPoisonMessage(message))
                    {
                        DistributedTransactionExceptionHandler.HandlePoisonMessage(message);
                        return(true); // will remove from queue and continue receive loop.
                    }
                }
                DoExecuteListener(message);
            }
            catch (Exception ex)
            {
                HandleDistributedTransactionListenerException(ex, message);
                throw; // will rollback and keep message on the queue.
            }
            finally
            {
                message.Dispose();
            }
            return(true);
        }