Enum BackpressureStrategy
- Namespace
- DotCompute.Abstractions.Messaging
- Assembly
- DotCompute.Abstractions.dll
Defines strategies for handling backpressure when a message queue is full.
public enum BackpressureStrategy
Fields
Block = 0Block the enqueueing thread until space becomes available.
Provides flow control but risks deadlock if producer/consumer are on the same thread or circular dependencies exist.
Best for: Producer can afford to wait, strong delivery guarantees needed
DropNew = 3Drop the new message silently without enqueueing.
Similar to Reject but returns true from TryEnqueue despite dropping. May cause message loss but maintains non-blocking behavior.
Best for: Fire-and-forget messaging, telemetry, non-critical data
DropOldest = 1Drop the oldest message from the queue and enqueue the new message.
Maintains queue capacity by evicting old messages. May lose data but ensures the most recent messages are processed.
Best for: Real-time systems, latest data more valuable than old data
Reject = 2Reject the new message by returning false from TryEnqueue.
Caller is responsible for handling rejection (retry, log, dead letter, etc.). No blocking, no data loss from the existing queue.
Best for: Caller has application-specific retry/fallback logic