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