Example #1
0
        /// <summary>
        /// OK - here's how stuff is nested:
        ///
        /// - Message queue transaction (TxBomkarl)
        ///     - Before/After transport message
        ///         - TransactionScope
        ///             - Before/After logical message
        ///                 Dispatch logical message
        /// </summary>
        void TryProcessIncomingMessage()
        {
            using (var context = new TxBomkarl())
            {
                try
                {
                    DoTry();

                    try
                    {
                        context.RaiseDoCommit();
                    }
                    catch (Exception commitException)
                    {
                        throw new QueueCommitException(commitException);
                    }
                }
                catch
                {
                    try
                    {
                        context.RaiseDoRollback();
                    }
                    catch (Exception e)
                    {
                        log.Error(e, "An error occurred while rolling back the transaction!");
                    }

                    throw;
                }
            }
        }
Example #2
0
 /// <summary>
 /// OK - here's how stuff is nested:
 ///
 /// - Message queue transaction (TxBomkarl)
 ///     - Before/After transport message
 ///         - TransactionScope
 ///             - Before/After logical message
 ///                 Dispatch logical message
 /// </summary>
 void TryProcessIncomingMessage()
 {
     using (var context = new TxBomkarl())
     {
         try
         {
             DoTry();
             context.RaiseDoCommit();
         }
         catch
         {
             context.RaiseDoRollback();
             throw;
         }
     }
 }
Example #3
0
        /// <summary>
        /// OK - here's how stuff is nested:
        /// 
        /// - Message queue transaction (TxBomkarl)
        ///     - Before/After transport message
        ///         - TransactionScope
        ///             - Before/After logical message
        ///                 Dispatch logical message
        /// </summary>
        async void TryProcessIncomingMessage()
        {
            using (var context = new TxBomkarl())
            {
                try
                {
                    await DoTry();

                    try
                    {
                        context.RaiseDoCommit();
                    }
                    catch (Exception commitException)
                    {
                        throw new QueueCommitException(commitException);
                    }
                }
                catch
                {
                    try
                    {
                        context.RaiseDoRollback();
                    }
                    catch (Exception e)
                    {
                        log.Error(e, "An error occurred while rolling back the transaction!");
                    }

                    throw;
                }
            }
        }