Class ConsumerTransactionManager
- Namespace
- Silverback.Messaging.Consuming.Transaction
- Assembly
- Silverback.Integration.dll
Handles the consumer transaction.
public sealed class ConsumerTransactionManager : IConsumerTransactionManager
- Inheritance
-
ConsumerTransactionManager
- Implements
- Inherited Members
Constructors
ConsumerTransactionManager(ConsumerPipelineContext, ISilverbackLogger<ConsumerTransactionManager>)
Initializes a new instance of the ConsumerTransactionManager class.
public ConsumerTransactionManager(ConsumerPipelineContext context, ISilverbackLogger<ConsumerTransactionManager> logger)
Parameters
contextConsumerPipelineContextThe current ConsumerPipelineContext.
loggerISilverbackLogger<ConsumerTransactionManager>The ISilverbackLogger.
Properties
Aborted
Gets the AsyncEvent<TArg> that is after the consumer is aborted.
public AsyncEvent<ConsumerPipelineContext> Aborted { get; }
Property Value
Aborting
Gets the AsyncEvent<TArg> that is before the consumer is aborted.
public AsyncEvent<ConsumerPipelineContext> Aborting { get; }
Property Value
Committed
Gets the AsyncEvent<TArg> that is after the consumer is committed.
public AsyncEvent<ConsumerPipelineContext> Committed { get; }
Property Value
Committing
Gets the AsyncEvent<TArg> that is fired before the consumer is committed.
public AsyncEvent<ConsumerPipelineContext> Committing { get; }
Property Value
Methods
CommitAsync()
Commits the transaction.
public Task CommitAsync()
Returns
RollbackAsync(Exception?, bool, bool, bool)
Aborts the transaction and causes the uncommitted changes to be rolled back.
public Task<bool> RollbackAsync(Exception? exception, bool commitConsumer = false, bool throwIfAlreadyCommitted = true, bool stopConsuming = true)
Parameters
exceptionExceptionThe exception that caused the rollback.
commitConsumerboolA value indicating whether the consumer have to be committed anyway. This depends on the error policy being applied.
throwIfAlreadyCommittedboolA value indicating whether an exception must be thrown if the transaction was already committed.
stopConsumingboolA value indicating whether the consumer must be stopped.
Returns
- Task<bool>
A Task<TResult> representing the asynchronous operation. The task result contains a value indicating whether the rollback was performed.