Path: redb-route/redb.Route.Sqs/SqsEndpointOptions.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.Sqs/SqsEndpointOptions.cs ---- using redb.Route.Core; namespace redb.Route.Sqs; /// /// Options for an SQS endpoint (sqs://queue-name?...). The queue name is taken from the URI /// path; every value below is bound from the query string. Consumer and producer options coexist — /// only the relevant subset applies to each direction. /// public sealed class SqsEndpointOptions : AwsEndpointOptions { // ── Addressing ──────────────────────────────────────────────────── /// Explicit queue URL. When empty it is resolved from the queue name (path) at start. public string QueueUrl { get; set; } = ""; /// Create the queue if it does not exist (uses the queue name; FIFO if it ends in .fifo). Default false. public bool AutoCreateQueue { get; set; } // ── Consumer (receive) ──────────────────────────────────────────── /// Long-poll wait time in seconds (0–20). Default 20 — fewer empty receives, lower cost. public int WaitTimeSeconds { get; set; } = 20; /// Messages fetched per ReceiveMessage call (1–10). Default 10. public int MaxNumberOfMessages { get; set; } = 10; /// Visibility timeout in seconds for received messages. 0 = use the queue default. public int VisibilityTimeout { get; set; } /// Concurrent receive/processing loops: a number or "auto" (= max(CPU, 2)). Default 1 (serial). // A string so "auto" binds verbatim instead of silently degrading to the int default. public string? ConcurrentConsumers { get; set; } /// Resolved consumer parallelism (see ). public int ResolvedConcurrentConsumers => ConcurrencyOption.Resolve(ConcurrentConsumers, "concurrentConsumers"); /// /// Keep extending a message's visibility while it is still being processed, so long handlers never /// trigger redelivery. Requires > 0. Default false. /// public bool ExtendMessageVisibility { get; set; } /// /// When a message is deleted from the queue (). Manual (default): after a turn that /// ended well; a failed one becomes visible again (at-least-once). Auto: on receipt, before the route runs /// (at-most-once). /// public AckMode AckMode { get; set; } = AckMode.Manual; /// protected override string? UnknownParameterHint(string name) => name.Equals("deleteAfterRead", StringComparison.OrdinalIgnoreCase) ? "'deleteAfterRead' is replaced by 'ackMode': ackMode=manual (the default) deletes after the route, as " + "deleteAfterRead=true did; ackMode=auto deletes on receipt. deleteAfterRead=false never deleted a message, " + "so every message came back after its visibility timeout." : null; /// /// On processing failure, immediately reset visibility to 0 so the message is redelivered at once /// (rather than waiting out the visibility timeout). Default false. /// public bool ResetVisibilityOnFailure { get; set; } /// Comma-separated system attribute names to request (e.g. All). Default All. public string AttributeNames { get; set; } = "All"; /// Comma-separated message-attribute names to request. Default All. public string MessageAttributeNames { get; set; } = "All"; // ── Batch mode ── /// /// Batch mode (Apache Camel batching): the route gets one InOnly exchange whose body is a /// List<IMessage> of up to messages, deleted once after the route. /// Collection is ruled by the batch options: , and /// are not used in batch mode. A batch's messages stay invisible while it is collected and /// routed, so (or the queue's own) must cover both. /// public bool Batching { get; set; } /// Largest number of messages in a batch (default 10). Collected over several receives of up to 10. public int? MaxBatchMessages { get; set; } /// /// Batch mode: a batch with messages is sent on once no message came for this many milliseconds, restarted by every /// receive that brought one (default 1000). A receive waits at least a second (SQS long-poll is in seconds). /// public int PollTimeoutMs { get; set; } = 1000; /// Batch mode: a batch is sent on once this many milliseconds have passed since its first message. public int? BatchingIntervalMs { get; set; } /// The default of : one receive's worth. internal const int DefaultMaxBatchMessages = 10; /// The batch options, or null outside batch mode. Set by . internal redb.Route.Batching.BatchOptions? Batch { get; private set; } /// /// Resolves the batch options. Fails, naming the endpoint, for a batch option without batching=true, a value /// out of range, and extendMessageVisibility (a batch is not kept invisible message by message: set a /// visibilityTimeout longer than a batch's route). /// internal void ResolveBatch(string endpoint) { Batch = redb.Route.Batching.BatchOptions.Resolve(endpoint, Batching, MaxBatchMessages, PollTimeoutMs, BatchingIntervalMs, DefaultMaxBatchMessages); if (Batch is not null && ExtendMessageVisibility) throw new InvalidOperationException( $"Endpoint '{endpoint}': batching=true cannot be combined with extendMessageVisibility: give the queue a " + "visibilityTimeout longer than a batch's route instead."); } /// /// Producer: whether the send joins the enclosing .Transacted() block. Unset, it follows the block: deferred /// until the database commits inside one, sent at once outside. true requires a block and fails outside one; /// false sends at once even inside one. A consumer always deletes the message itself once the route has /// finished successfully, so the option does not apply to it. /// public bool? Transacted { get; set; } /// Delay in milliseconds after an empty receive before polling again. Default 0. public int Delay { get; set; } /// Initial delay in milliseconds before the first poll. Default 0. public int InitialDelay { get; set; } // ── Producer (send) ─────────────────────────────────────────────── /// Delivery delay in seconds for sent messages (0–900). Default 0. public int DelaySeconds { get; set; } /// FIFO message group id (required for FIFO queues). Supports ${...} expressions. public DynamicValue? MessageGroupId { get; set; } /// FIFO deduplication id. Supports ${...} expressions. Omit when the queue has content-based dedup. public DynamicValue? MessageDeduplicationId { get; set; } /// public override void Validate() { ValidateAws(); if (WaitTimeSeconds is < 0 or > 20) throw new ArgumentException($"waitTimeSeconds must be 0–20. Got: {WaitTimeSeconds}"); if (MaxNumberOfMessages is < 1 or > 10) throw new ArgumentException($"maxNumberOfMessages must be 1–10. Got: {MaxNumberOfMessages}"); _ = ConcurrencyOption.Resolve(ConcurrentConsumers, "concurrentConsumers"); // loud on garbage if (VisibilityTimeout < 0) throw new ArgumentException($"visibilityTimeout cannot be negative. Got: {VisibilityTimeout}"); if (ExtendMessageVisibility && VisibilityTimeout <= 0) throw new ArgumentException("extendMessageVisibility requires visibilityTimeout > 0."); if (AckMode == AckMode.Auto && (ExtendMessageVisibility || ResetVisibilityOnFailure)) throw new ArgumentException( "ackMode=auto deletes a message on receipt, so there is no visibility left to extend or reset: " + "extendMessageVisibility and resetVisibilityOnFailure need ackMode=manual."); if (DelaySeconds is < 0 or > 900) throw new ArgumentException($"delaySeconds must be 0–900. Got: {DelaySeconds}"); } }