dotnet-cqrs/Svrnty.CQRS.Events.Abstractions/Subscriptions/SubscriptionMode.cs

50 lines
1.8 KiB
C#

namespace Svrnty.CQRS.Events.Abstractions.Subscriptions;
/// <summary>
/// Defines how events are distributed to consumers in a subscription.
/// </summary>
/// <remarks>
/// <para>
/// <strong>Broadcast</strong>: All consumers receive all events (pub/sub pattern).
/// Use for notifications where every consumer needs every event.
/// </para>
/// <para>
/// <strong>Exclusive</strong>: Only one consumer receives each event (queue pattern).
/// Use for work distribution where only one worker should process each event.
/// </para>
/// <para>
/// <strong>ConsumerGroup</strong>: Load-balanced distribution across group members (Kafka-style).
/// Use for scalable processing where multiple workers share the load.
/// </para>
/// <para>
/// <strong>ReadReceipt</strong>: Requires explicit confirmation that user saw the event.
/// Use for user notifications where you need to track delivered vs read status.
/// </para>
/// </remarks>
public enum SubscriptionMode
{
/// <summary>
/// Broadcast mode: All consumers receive all events (publish/subscribe pattern).
/// Each consumer gets its own copy of every event.
/// </summary>
Broadcast = 0,
/// <summary>
/// Exclusive mode: Only one consumer receives each event (queue pattern).
/// Events are distributed to exactly one consumer in a round-robin fashion.
/// </summary>
Exclusive = 1,
/// <summary>
/// Consumer group mode: Load-balanced across group members (Kafka-style partitioning).
/// Events are distributed across all active consumers in the group for parallel processing.
/// </summary>
ConsumerGroup = 2,
/// <summary>
/// Read receipt mode: Requires explicit "user saw this" confirmation.
/// Tracks delivered vs read status, useful for user-facing notifications with unread counts.
/// </summary>
ReadReceipt = 3
}