-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
enhancementNew feature or requestNew feature or requestfeatureThis label is in use for minor version incrementsThis label is in use for minor version increments
Milestone
Description
Title: Add idempotency pipeline behavior for at-least-once command delivery
Labels: enhancement, mediator, new-package
Body:
Problem
In event-driven systems using Cortex.Streams with Kafka (at-least-once delivery), the same command may be dispatched multiple times. Without idempotency support, this causes duplicate side effects.
Proposed Solution
Create a Cortex.Mediator.Behaviors.Idempotency package:
IIdempotentCommandinterface withIdempotencyKeypropertyIdempotencyCommandBehavior<TCommand, TResult>-- checks if a command with the same key was already processed, returns the cached result if soIIdempotencyStoreinterface with in-memory and pluggable (e.g., database/Redis) implementations- Configurable TTL for idempotency records
public class ProcessPaymentCommand : ICommand<PaymentResult>, IIdempotentCommand
{
public string IdempotencyKey => $"payment-{OrderId}-{Amount}";
public Guid OrderId { get; set; }
public decimal Amount { get; set; }
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestfeatureThis label is in use for minor version incrementsThis label is in use for minor version increments