DotNetWorkQueue.Transport.SqlServer.Basic.Message.RollbackMessage.RollbackForTransaction C# (CSharp) Method

RollbackForTransaction() public method

Rollbacks the specified message by rolling back the transaction
public RollbackForTransaction ( IMessageContext context ) : void
context IMessageContext The context.
return void
        public void RollbackForTransaction(IMessageContext context)
        {
            var connection = context.Get(_headers.Connection);
            //if transaction open, then just rollback the transaction
            if (connection.SqlConnection == null || connection.SqlTransaction == null) return;

            if (_configuration.Options().EnableStatusTable)
            {
                _setStatusCommandHandler.Handle(new SetStatusTableStatusCommand((long)context.MessageId.Id.Value, QueueStatuses.Waiting));
            }
            connection.SqlTransaction.Rollback();
        }