Class InMemoryOutboxReader
Reads from the in-memory outbox.
Implements
Inherited Members
Namespace: Silverback.Messaging.Producing.TransactionalOutbox
Assembly: Silverback.Storage.Memory.dll
Syntax
public class InMemoryOutboxReader : IOutboxReader
Constructors
InMemoryOutboxReader(InMemoryOutbox)
Initializes a new instance of the InMemoryOutboxReader class.
Declaration
public InMemoryOutboxReader(InMemoryOutbox outbox)
Parameters
| Type | Name | Description |
|---|---|---|
| InMemoryOutbox | outbox | The in-memory outbox shared between the InMemoryOutboxWriter and InMemoryOutboxReader. |
Methods
AcknowledgeAsync(IEnumerable<OutboxMessage>)
Called after the messages have been successfully produced to remove them from the outbox.
Declaration
public Task AcknowledgeAsync(IEnumerable<OutboxMessage> outboxMessages)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<OutboxMessage> | outboxMessages | The acknowledged messages. |
Returns
| Type | Description |
|---|---|
| Task | A Task representing the result of the asynchronous operation. |
GetAsync(int)
Reads the specified number of messages from the outbox (according to the FIFO rule). The operation must be acknowledged for the messages to be removed.
Declaration
public Task<IDisposableAsyncEnumerable<OutboxMessage>> GetAsync(int count)
Parameters
| Type | Name | Description |
|---|---|---|
| int | count | The number of items to be dequeued. |
Returns
| Type | Description |
|---|---|
| Task<IDisposableAsyncEnumerable<OutboxMessage>> | A Task representing the result of the asynchronous operation. The task result contains the collection of OutboxMessage. |
GetLengthAsync()
Returns the total number of messages in the outbox.
Declaration
public Task<int> GetLengthAsync()
Returns
| Type | Description |
|---|---|
| Task<int> | A Task<TResult> representing the asynchronous operation. The task result contains the number of messages in the outbox. |
GetMaxAgeAsync()
Gets a TimeSpan representing the time elapsed since the oldest message currently in the outbox was written.
Declaration
public Task<TimeSpan> GetMaxAgeAsync()
Returns
| Type | Description |
|---|---|
| Task<TimeSpan> | The age of the oldest message. |