Path: redb-route/redb.Route.Sqs/AwsEndpointOptions.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/AwsEndpointOptions.cs
----
using redb.Route.Abstractions;
using redb.Route.Core;
namespace redb.Route.Sqs;
///
/// Base endpoint options shared by the SQS and SNS endpoints — AWS connection/credentials.
/// Bound from the URI query string by (reflection includes
/// these inherited properties). Credentials resolution mirrors redb.Route.S3.
///
public abstract class AwsEndpointOptions : EndpointOptions
{
///
/// Explicit service endpoint URL (e.g. http://localhost:4566 for LocalStack / ElasticMQ).
/// When set, it overrides the region endpoint. Empty = use the AWS region endpoint.
///
public string ServiceUrl { get; set; } = "";
/// AWS region (e.g. us-east-1, eu-west-1). Default us-east-1.
public string Region { get; set; } = "us-east-1";
///
/// A registry reference (#name) to an that
/// decides which headers this endpoint carries between the exchange and message attributes, in place of
/// (SQS) or (SNS).
///
[RegistryReference(typeof(IHeaderFilterStrategy))]
public string? HeaderFilterStrategy { get; set; }
/// AWS access key ID. Required unless or is used.
[Sensitive]
public string AccessKey { get; set; } = "";
/// AWS secret access key.
[Sensitive]
public string SecretKey { get; set; } = "";
/// AWS session token for temporary (STS) credentials.
[Sensitive]
public string SessionToken { get; set; } = "";
/// Named AWS profile from the shared credentials file. Overrides access/secret keys when set.
public string ProfileName { get; set; } = "";
/// Use the default AWS credential provider chain (env vars / instance profile / SSO). Default false.
public bool UseDefaultCredentialsProvider { get; set; }
/// Name of a pre-registered connection factory in the route registry (overrides URI credentials when found).
[RegistryReference(typeof(AwsConnectionFactory))]
public string ConnectionFactory { get; set; } = "";
/// Maximum SDK retry attempts on transient errors. Default 3.
public int RetryCount { get; set; } = 3;
/// HTTP client timeout in milliseconds. Default 30000.
public int ConnectionTimeout { get; set; } = 30000;
/// Optional HTTP proxy host.
public string ProxyHost { get; set; } = "";
/// Optional HTTP proxy port.
public int ProxyPort { get; set; }
/// Validates the shared AWS options. Concrete option classes call this from .
protected void ValidateAws()
{
var haveStaticKeys = !string.IsNullOrEmpty(AccessKey) && !string.IsNullOrEmpty(SecretKey);
if (!UseDefaultCredentialsProvider
&& string.IsNullOrEmpty(ProfileName)
&& string.IsNullOrEmpty(ConnectionFactory)
&& !haveStaticKeys)
{
throw new ArgumentException(
"AWS credentials required: set accessKey+secretKey, or profileName, or useDefaultCredentialsProvider=true, "
+ "or a registered connectionFactory.");
}
if (RetryCount < 0)
throw new ArgumentException($"retryCount cannot be negative. Got: {RetryCount}");
if (ConnectionTimeout <= 0)
throw new ArgumentException($"connectionTimeout must be positive. Got: {ConnectionTimeout}");
}
}