API reference — Reliable messaging
Nuvora.Nexus.Relay.Inbox.EfCore
EF Core inbox (idempotent consumer) store for Nuvora Nexus Relay
dotnet add package Nuvora.Nexus.Relay.Inbox.EfCore
Nuvora.Nexus.Relay.Inbox.EfCore
EfCoreInboxRepository
public sealed class EfCoreInboxRepository : IInboxRepository
EF Core IInboxRepository. The dedup row is staged on the command’s shared DbContext (via IRelayDbContextAccessor) so it commits in the same transaction as the handler’s effects. The unique primary key on message_id makes concurrent duplicate deliveries safe (one commit wins; the loser is redelivered and then skipped).
Constructors
EfCoreInboxRepository(IRelayDbContextAccessor contextAccessor, IRelayTenantAccessor? tenant = null)
Methods
Task MarkProcessedAsync(Guid messageId, string messageType, CancellationToken cancellationToken = default(CancellationToken))
Stages a processed-message row (flushed by the unit of work’s commit).
Task<bool> HasProcessedAsync(Guid messageId, CancellationToken cancellationToken = default(CancellationToken))
True if this message was already processed (and should be skipped).
Task<int> DeleteProcessedBeforeAsync(DateTimeOffset olderThan, CancellationToken cancellationToken = default(CancellationToken))
Deletes dedup rows processed before olderThan (maintenance/retention). Executes immediately in its own statement rather than staging, and is safe to run concurrently from multiple instances (the delete is idempotent). Keep the retention window longer than the broker’s maximum redelivery delay so a late redelivery is still deduplicated.
InboxRecord
public class InboxRecord
Persistence row recording that an inbound message was processed (dedup key).
Properties
DateTimeOffset ProcessedAt { get; set; }
Guid MessageId { get; set; }
Guid? TenantId { get; set; }
Owning tenant (null = global), re-established from the broker header before dedup.
string MessageType { get; set; }
Nuvora.Nexus.Relay.Inbox.EfCore.DependencyInjection
InboxServiceCollectionExtensions
public static class InboxServiceCollectionExtensions
Registration helper for the EF Core inbox repository. The dedup row stages on the same context the event-store accessor exposes, so register AddRelayEventStoreEfCore as well, and call ApplyRelayInbox() in the host context’s OnModelCreating.
Methods
static IServiceCollection AddRelayInboxEfCore(this IServiceCollection services)
Nuvora.Nexus.Relay.Inbox.EfCore.Persistence
InboxModelBuilderExtensions
public static class InboxModelBuilderExtensions
Maps the inbox dedup table onto the host’s DbContext. Call from OnModelCreating so it lives in the same database/context as the read model the consumer writes.
Methods
static ModelBuilder ApplyRelayInbox(this ModelBuilder modelBuilder)