Search Results for

    Show / Hide Table of Contents

    Class EfInboxStore

    Entity Framework Core implementation of IInboxStore and ICleanupStore. Relies on a unique database constraint on (MessageId, ConsumerTypeName) to provide atomic reservations, and supports both at‑most‑once and at‑least‑once delivery via ChaparInboxOptions.

    Inheritance
    object
    EfInboxStore
    Implements
    IInboxStore
    ICleanupStore
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Chapar.Inbox.EntityFrameworkCore.Stores
    Assembly: Chapar.Inbox.EntityFrameworkCore.dll
    Syntax
    public sealed class EfInboxStore : IInboxStore, ICleanupStore

    Constructors

    | Edit this page View Source

    EfInboxStore(IChaparDbContext, IOptions<ChaparInboxOptions>?)

    Initializes a new instance of the EfInboxStore class.

    Declaration
    public EfInboxStore(IChaparDbContext dbContext, IOptions<ChaparInboxOptions>? options = null)
    Parameters
    Type Name Description
    IChaparDbContext dbContext

    The IChaparDbContext used to access the inbox table.

    IOptions<ChaparInboxOptions> options

    The inbox configuration options (optional; falls back to defaults).

    Methods

    | Edit this page View Source

    DeleteProcessedAsync(DateTime, CancellationToken)

    Deletes all processed records older than the specified date. Returns the number of deleted records.

    Declaration
    public Task<int> DeleteProcessedAsync(DateTime olderThan, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    DateTime olderThan

    Cutoff date; records processed before this will be deleted.

    CancellationToken cancellationToken

    Cancellation token.

    Returns
    Type Description
    Task<int>

    Number of deleted records.

    | Edit this page View Source

    MarkAsProcessedAsync(InboxMessage, CancellationToken)

    Marks a previously reserved message as completely processed. Called only after the handler has finished without exception.

    Declaration
    public Task<bool> MarkAsProcessedAsync(InboxMessage message, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    InboxMessage message

    The inbox message record that should be updated.

    CancellationToken cancellationToken

    Cancellation token.

    Returns
    Type Description
    Task<bool>

    true if the message was marked for the first time; false if it was already processed.

    | Edit this page View Source

    TryReserveAsync(string, string, CancellationToken)

    Attempts to atomically reserve an incoming message for processing. When the method returns true the caller is the exclusive processor of the message; when it returns false the message has already been reserved by another consumer.

    Declaration
    public Task<bool> TryReserveAsync(string messageId, string consumerTypeName, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string messageId

    The unique identifier of the incoming message.

    string consumerTypeName

    The fully qualified type name of the consumer that will handle the message.

    CancellationToken cancellationToken

    Cancellation token.

    Returns
    Type Description
    Task<bool>

    true if the reservation was successful; otherwise false.

    Implements

    IInboxStore
    ICleanupStore
    • Edit this page
    • View Source
    In this article
    Back to top Copyright © 2026