Class DbInboundLog
Used by the LogExactlyOnceStrategy to keep track of each processed message and guarantee that each one is processed only once.
An IDbContext is used to store the log into the database.
Inherited Members
Namespace: Silverback.Messaging.Inbound.ExactlyOnce.Repositories
Assembly: Silverback.Integration.dll
Syntax
public class DbInboundLog : RepositoryBase<InboundLogEntry>, IInboundLog, ITransactional
Constructors
| Improve this doc View sourceDbInboundLog(IDbContext)
Initializes a new instance of the DbInboundLog class.
Declaration
public DbInboundLog(IDbContext dbContext)
Parameters
Type | Name | Description |
---|---|---|
IDbContext | dbContext | The IDbContext to use as storage. |
Methods
| Improve this doc View sourceAddAsync(IRawInboundEnvelope)
Add the message contained in the specified envelope to the log.
Declaration
public Task AddAsync(IRawInboundEnvelope envelope)
Parameters
Type | Name | Description |
---|---|---|
IRawInboundEnvelope | envelope | The envelope containing the message to be added. |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
CommitAsync()
Called when the message has been successfully processed to commit the transaction.
Declaration
public Task CommitAsync()
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
ExistsAsync(IRawInboundEnvelope)
Returns a boolean value indicating whether this very same message has already been logged for the same consumer group.
Declaration
public Task<bool> ExistsAsync(IRawInboundEnvelope envelope)
Parameters
Type | Name | Description |
---|---|---|
IRawInboundEnvelope | envelope | The envelope containing the message to be checked. |
Returns
Type | Description |
---|---|
Task<bool> | A Task<TResult> representing the asynchronous operation. The task result contains a value indicating whether the message was found in the log. |
GetLengthAsync()
Returns the total number of messages in the log.
Declaration
public Task<int> GetLengthAsync()
Returns
Type | Description |
---|---|
Task<int> | A Task<TResult> representing the result of the asynchronous operation. The task result contains the log length. |
RollbackAsync()
Called when an exception occurs during the message processing to rollback the transaction.
Declaration
public Task RollbackAsync()
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |