Path: redb-route/redb.Route.Sqs/SnsEndpointOptions.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/SnsEndpointOptions.cs
----
using redb.Route.Core;
namespace redb.Route.Sqs;
///
/// Options for an SNS endpoint (sns://topic-name?...). SNS is publish-only (there is no pull
/// consumer — delivery is push to SQS/HTTP/email/SMS), so these options drive the publisher plus the
/// optional SNS→SQS auto-subscription convenience.
///
public sealed class SnsEndpointOptions : AwsEndpointOptions
{
/// Explicit topic ARN. When empty it is resolved from the topic name (path) at start.
public string TopicArn { get; set; } = "";
/// Create the topic if it does not exist (FIFO when the name ends in .fifo). Default false.
public bool AutoCreateTopic { get; set; }
/// Optional message subject (used by email delivery). Supports ${...} expressions.
public string Subject { get; set; } = "";
/// Set to json to send a protocol-specific message structure (per-transport payloads).
public string MessageStructure { get; set; } = "";
/// FIFO topic message group id. Supports ${...} expressions.
public DynamicValue? MessageGroupId { get; set; }
/// FIFO deduplication id. Supports ${...} expressions. Omit for content-based dedup.
public DynamicValue? MessageDeduplicationId { get; set; }
/// At start, subscribe the SQS queue named by to this topic. Default false.
public bool SubscribeSnsToSqs { get; set; }
/// ARN of the SQS queue to subscribe when is true.
public string SubscribeQueueArn { get; set; } = "";
///
/// When auto-subscribing via , also set the subscription's
/// RawMessageDelivery=true so the SQS queue receives the bare payload (and SNS message
/// attributes map to SQS message attributes — which restores W3C trace continuity across the hop)
/// instead of the default SNS JSON notification envelope. Default false (AWS-compatible envelope).
///
public bool RawMessageDelivery { get; set; }
///
/// Whether the publish joins the enclosing .Transacted() block. Unset, it follows the block: deferred until
/// the database commits inside one, published at once outside. true requires a block and fails outside one;
/// false publishes at once even inside one.
///
public bool? Transacted { get; set; }
///
public override void Validate()
{
ValidateAws();
if (SubscribeSnsToSqs && string.IsNullOrEmpty(SubscribeQueueArn))
throw new ArgumentException("subscribeSnsToSqs=true requires subscribeQueueArn (the SQS queue ARN).");
}
}