Search Results for

    Show / Hide Table of Contents

    Class InMemoryEventHubStorage

    Inheritance
    object
    InMemoryEventHubStorage
    Implements
    IEventHubStorageProvider<InMemoryEventStorageRecord>
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: FastEndpoints
    Assembly: FastEndpoints.Messaging.Remote.dll
    Syntax
    public sealed class InMemoryEventHubStorage : IEventHubStorageProvider<InMemoryEventStorageRecord>

    Methods

    GetNextBatchAsync(PendingRecordSearchParams<InMemoryEventStorageRecord>)

    fetch the next batch of pending event storage records that need to be processed.

    Declaration
    public ValueTask<IEnumerable<InMemoryEventStorageRecord>> GetNextBatchAsync(PendingRecordSearchParams<InMemoryEventStorageRecord> p)
    Parameters
    Type Name Description
    PendingRecordSearchParams<InMemoryEventStorageRecord> p
    Returns
    Type Description
    ValueTask<IEnumerable<InMemoryEventStorageRecord>>

    MarkEventAsCompleteAsync(InMemoryEventStorageRecord, CancellationToken)

    mark the event storage record as complete by either replacing the entity on storage with the supplied instance or simply update the IsComplete field to true with a partial update operation.

    Declaration
    public ValueTask MarkEventAsCompleteAsync(InMemoryEventStorageRecord e, CancellationToken ct)
    Parameters
    Type Name Description
    InMemoryEventStorageRecord e
    CancellationToken ct

    cancellation token

    Returns
    Type Description
    ValueTask

    PurgeStaleRecordsAsync(StaleRecordSearchParams<InMemoryEventStorageRecord>)

    this method will be called hourly. implement this method to remove stale records (completed or expired) from storage. or instead of removing them, you can move them to some other location (dead-letter-queue maybe) or for inspection by a human. or if you'd like to retry expired events, update the ExpireOn field to a future date/time.

    NOTE: the default match criteria is:

    r => r.IsComplete || DateTime.UtcNow >= r.ExpireOn
    Declaration
    public ValueTask PurgeStaleRecordsAsync(StaleRecordSearchParams<InMemoryEventStorageRecord> p)
    Parameters
    Type Name Description
    StaleRecordSearchParams<InMemoryEventStorageRecord> p
    Returns
    Type Description
    ValueTask

    RestoreSubscriberIDsForEventTypeAsync(SubscriberIDRestorationParams<InMemoryEventStorageRecord>)

    this method will only be called once (for each event type) on app startup. if there are any pending records on storage from a previous app run, simply return a collection of unique subscriber IDs.

    Declaration
    public ValueTask<IEnumerable<string>> RestoreSubscriberIDsForEventTypeAsync(SubscriberIDRestorationParams<InMemoryEventStorageRecord> p)
    Parameters
    Type Name Description
    SubscriberIDRestorationParams<InMemoryEventStorageRecord> p
    Returns
    Type Description
    ValueTask<IEnumerable<string>>

    StoreEventsAsync(IEnumerable<InMemoryEventStorageRecord>, CancellationToken)

    store the event storage records however you please. ideally on a nosql database.

    WARNING: make sure to use a transaction or batch insert to ensure all the records are committed in one go. if only some of the records succeed in being stored, it could lead to duplicate events being published due to the built-in retry mechanism.

    Declaration
    public ValueTask StoreEventsAsync(IEnumerable<InMemoryEventStorageRecord> records, CancellationToken _)
    Parameters
    Type Name Description
    IEnumerable<InMemoryEventStorageRecord> records
    CancellationToken _
    Returns
    Type Description
    ValueTask

    Implements

    IEventHubStorageProvider<TStorageRecord>
    In this article
    Back to top Developed by Đĵ ΝιΓΞΗΛψΚ and contributors / Licensed under MIT / Website generated by DocFX