Show / Hide Table of Contents

    Class OutboxWorker

    Processes the outbox and produces the messages to the target message broker endpoint.

    Inheritance
    object
    OutboxWorker
    Implements
    IOutboxWorker
    IDisposable
    Inherited Members
    object.GetType()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: Silverback.Messaging.Producing.TransactionalOutbox
    Assembly: Silverback.Integration.dll
    Syntax
    public sealed class OutboxWorker : IOutboxWorker, IDisposable

    Constructors

    OutboxWorker(OutboxWorkerSettings, IOutboxReader, IProducerCollection, ISilverbackLogger<OutboxWorker>)

    Initializes a new instance of the OutboxWorker class.

    Declaration
    public OutboxWorker(OutboxWorkerSettings settings, IOutboxReader outboxReader, IProducerCollection producers, ISilverbackLogger<OutboxWorker> logger)
    Parameters
    Type Name Description
    OutboxWorkerSettings settings

    The worker settings.

    IOutboxReader outboxReader

    The IOutboxReader to be used to retrieve the pending messages.

    IProducerCollection producers

    The IProducerCollection.

    ISilverbackLogger<OutboxWorker> logger

    The ISilverbackLogger<TCategoryName>.

    Methods

    Dispose()

    Processes the outbox and produces the messages to the target message broker endpoint.

    Declaration
    public void Dispose()

    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.

    ProcessOutboxAsync(CancellationToken)

    Processes the outbox relaying the stored messages.

    Declaration
    public Task<bool> ProcessOutboxAsync(CancellationToken stoppingToken)
    Parameters
    Type Name Description
    CancellationToken stoppingToken

    A CancellationToken to observe while waiting for the task to complete.

    Returns
    Type Description
    Task<bool>

    A Task<TResult> representing the asynchronous operation. The task result contains a value indicating whether the outbox contained at least 1 message, and it was successfully processed. The caller should ideally keep invoking this method in a loop, until false is returned.

    Implements

    IOutboxWorker
    IDisposable
    GitHub E-Mail
    ↑ Back to top © 2026 Sergio Aquilini