Table of Contents

Class MessageQueueOptions

Namespace
DotCompute.Abstractions.Messaging
Assembly
DotCompute.Abstractions.dll

Configuration options for Ring Kernel message queues.

public sealed class MessageQueueOptions
Inheritance
MessageQueueOptions
Inherited Members

Remarks

Controls queue behavior including capacity, priority handling, deduplication, and backpressure strategies.

Properties

BackpressureStrategy

Gets or sets the backpressure strategy when the queue is full.

public BackpressureStrategy BackpressureStrategy { get; set; }

Property Value

BackpressureStrategy

Remarks

Determines behavior when attempting to enqueue to a full queue:

  • Block: Wait until space available (may deadlock if not careful)
  • Drop: Silently drop the oldest message and enqueue new one
  • Reject: Throw InvalidOperationException

Default: Block

BlockTimeout

Gets or sets the block timeout when using Block.

public TimeSpan BlockTimeout { get; set; }

Property Value

TimeSpan

Remarks

Maximum time to wait for queue space before throwing exception. Set to InfiniteTimeSpan to wait indefinitely.

Default: 5 seconds

Capacity

Gets or sets the maximum queue capacity (number of messages).

public int Capacity { get; set; }

Property Value

int

Remarks

Must be a power of 2 for efficient modulo operations in ring buffer. Values are automatically rounded up to the nearest power of 2.

Default: 1024 messages Range: 16 - 1048576 (16 - 1M messages)

DeduplicationWindowSize

Gets or sets the deduplication window size (number of message IDs to track).

public int DeduplicationWindowSize { get; set; }

Property Value

int

Remarks

Only used when EnableDeduplication is true. Older message IDs are evicted when this limit is reached. Must be between 16 and Capacity * 4 (validation enforced).

Default: 256 messages (compatible with small queues)

EnableDeduplication

Gets or sets a value indicating whether to enable message deduplication.

public bool EnableDeduplication { get; set; }

Property Value

bool

Remarks

When true, duplicate messages (same MessageId) are silently dropped. Uses a concurrent set to track recently seen message IDs.

Deduplication adds ~10ns overhead per enqueue operation and consumes 16 bytes per tracked message ID.

Default: true

EnablePriorityQueue

Gets or sets a value indicating whether to use a priority queue.

public bool EnablePriorityQueue { get; set; }

Property Value

bool

Remarks

When true, messages are dequeued in priority order (highest first). When false, messages are dequeued in FIFO order.

Priority queues have higher overhead (~50ns vs ~20ns per operation) but ensure critical messages are processed first.

Default: false (FIFO queue)

MessageTimeout

Gets or sets the message timeout duration.

public TimeSpan MessageTimeout { get; set; }

Property Value

TimeSpan

Remarks

Messages older than this timeout are automatically removed during dequeue operations. Set to Zero to disable.

Default: 30 seconds

Methods

Validate()

Validates the options and normalizes values.

public void Validate()

Exceptions

ArgumentOutOfRangeException

Thrown when options are invalid.