Path: redb-route/redb.Route.Sqs/AwsConnectionFactory.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/AwsConnectionFactory.cs
----
using Amazon.Runtime;
using Amazon.SimpleNotificationService;
using Amazon.SQS;
namespace redb.Route.Sqs;
///
/// Reusable AWS credentials/endpoint holder that can be pre-registered in the route registry and
/// referenced from a URI via connectionFactory=name (mirrors redb.Route.S3). One factory
/// builds both SQS and SNS clients since they share credentials, region and service URL.
///
public sealed class AwsConnectionFactory : AwsEndpointOptions
{
///
/// No endpoint-shape validation for a bare factory — only credential resolution matters.
public override void Validate() => ValidateAws();
/// Builds a configured client.
public IAmazonSQS BuildSqs()
{
var config = new AmazonSQSConfig();
AwsClientSupport.ApplyCommonConfig(config, this);
return new AmazonSQSClient(AwsClientSupport.ResolveCredentials(this), config);
}
/// Builds a configured client.
public IAmazonSimpleNotificationService BuildSns()
{
var config = new AmazonSimpleNotificationServiceConfig();
AwsClientSupport.ApplyCommonConfig(config, this);
return new AmazonSimpleNotificationServiceClient(AwsClientSupport.ResolveCredentials(this), config);
}
}