Table of Contents

Class InMemoryOutboxReader

Namespace
Silverback.Messaging.Producing.TransactionalOutbox
Assembly
Silverback.Storage.Memory.dll

Reads from the in-memory outbox.

public class InMemoryOutboxReader : IOutboxReader
Inheritance
InMemoryOutboxReader
Implements
Inherited Members

Constructors

InMemoryOutboxReader(InMemoryOutbox)

Initializes a new instance of the InMemoryOutboxReader class.

public InMemoryOutboxReader(InMemoryOutbox outbox)

Parameters

outbox InMemoryOutbox

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.

public Task AcknowledgeAsync(IEnumerable<OutboxMessage> outboxMessages)

Parameters

outboxMessages IEnumerable<OutboxMessage>

The acknowledged messages.

Returns

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.

public Task<IDisposableAsyncEnumerable<OutboxMessage>> GetAsync(int count)

Parameters

count int

The number of items to be dequeued.

Returns

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.

public Task<int> GetLengthAsync()

Returns

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.

public Task<TimeSpan> GetMaxAgeAsync()

Returns

Task<TimeSpan>

The age of the oldest message.