![]() |
VOOZH | about |
dotnet add package Excalibur.Dispatch.Transport.AwsSqs --version 3.0.0-alpha.208
NuGet\Install-Package Excalibur.Dispatch.Transport.AwsSqs -Version 3.0.0-alpha.208
<PackageReference Include="Excalibur.Dispatch.Transport.AwsSqs" Version="3.0.0-alpha.208" />
<PackageVersion Include="Excalibur.Dispatch.Transport.AwsSqs" Version="3.0.0-alpha.208" />Directory.Packages.props
<PackageReference Include="Excalibur.Dispatch.Transport.AwsSqs" />Project file
paket add Excalibur.Dispatch.Transport.AwsSqs --version 3.0.0-alpha.208
#r "nuget: Excalibur.Dispatch.Transport.AwsSqs, 3.0.0-alpha.208"
#:package Excalibur.Dispatch.Transport.AwsSqs@3.0.0-alpha.208
#addin nuget:?package=Excalibur.Dispatch.Transport.AwsSqs&version=3.0.0-alpha.208&prereleaseInstall as a Cake Addin
#tool nuget:?package=Excalibur.Dispatch.Transport.AwsSqs&version=3.0.0-alpha.208&prereleaseInstall as a Cake Tool
AWS messaging transport implementation for the Excalibur framework, providing integration with Amazon SQS, SNS, and EventBridge services.
This package is included in the following metapackages:
| Metapackage | Tier | What It Adds |
|---|---|---|
Excalibur.Dispatch.Aws |
Starter | + Resilience (Polly) + Observability |
Tip: If you are getting started, install
Excalibur.Dispatch.Awsinstead of this package directly. It includes production-ready defaults.
This package provides AWS messaging integration for Excalibur.Dispatch, enabling:
dotnet add package Excalibur.Dispatch.Transport.AwsSqs
AWS SDK automatically discovers credentials from environment, IAM roles, or credential files:
services.AddAwsSqs(options =>
{
options.QueueUrl = new Uri("https://sqs.us-east-1.amazonaws.com/123456789/my-queue");
options.Region = "us-east-1";
});
services.AddAwsSqs(options =>
{
options.QueueUrl = new Uri("https://sqs.us-east-1.amazonaws.com/123456789/my-queue");
options.Region = "us-east-1";
options.Credentials = new BasicAWSCredentials("accessKey", "secretKey");
});
Configure via environment variables for containerized deployments:
AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key
AWS_REGION=us-east-1
SQS_QUEUE_URL=https://sqs.us-east-1.amazonaws.com/123456789/my-queue
services.AddAwsSqs(options =>
{
options.QueueUrl = new Uri(Environment.GetEnvironmentVariable("SQS_QUEUE_URL")!);
options.Region = Environment.GetEnvironmentVariable("AWS_REGION") ?? "us-east-1";
});
Use LocalStack for local development without AWS credentials:
services.AddAwsSqs(options =>
{
options.UseLocalStack = true;
options.LocalStackUrl = new Uri("http://localhost:4566");
options.QueueUrl = new Uri("http://localhost:4566/000000000000/my-queue");
});
For EC2, ECS, Lambda, or EKS deployments, use IAM roles:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"sqs:SendMessage",
"sqs:ReceiveMessage",
"sqs:DeleteMessage",
"sqs:GetQueueAttributes",
"sqs:ChangeMessageVisibility"
],
"Resource": "arn:aws:sqs:us-east-1:123456789:my-queue"
}
]
}
services.AddAwsSqs(options =>
{
options.Credentials = new AssumeRoleAWSCredentials(
new BasicAWSCredentials("accessKey", "secretKey"),
"arn:aws:iam::123456789:role/my-role",
"session-name");
options.Region = "us-east-1";
});
Use AWS CLI profiles with SSO:
services.AddAwsSqs(options =>
{
options.Credentials = new ProfileAWSCredentials("my-sso-profile");
options.Region = "us-east-1";
});
services.AddAwsSqs(options =>
{
options.QueueUrl = new Uri("https://sqs.us-east-1.amazonaws.com/123456789/my-queue");
// Polling configuration
options.MaxNumberOfMessages = 10; // Max messages per receive (1-10)
options.WaitTimeSeconds = TimeSpan.FromSeconds(20); // Long polling wait time (0-20 seconds)
options.VisibilityTimeout = TimeSpan.FromSeconds(30); // Message lock timeout
// Message retention
options.MessageRetentionPeriod = 345600; // 4 days (in seconds)
});
services.AddAwsSqs(options =>
{
options.QueueUrl = new Uri("https://sqs.us-east-1.amazonaws.com/123456789/my-queue.fifo");
// FIFO-specific options
options.UseFifoQueue = true;
options.ContentBasedDeduplication = true; // Auto-generate deduplication ID from content
});
services.AddAwsSqs(options =>
{
options.BatchConfig = new BatchOptions
{
MaxBatchSize = 10, // Messages per batch (max 10)
MaxBatchWaitTime = TimeSpan.FromMilliseconds(100)
};
});
services.AddAwsSqs(options =>
{
options.LongPollingConfig = new LongPollingOptions
{
QueueUrl = new Uri("https://sqs.us-east-1.amazonaws.com/123456789/my-queue"),
};
options.LongPollingConfig.Polling.MaxWaitTimeSeconds = 20;
options.LongPollingConfig.Adaptive.Enabled = true;
});
Compress large payloads when publishing to stay within the 256 KB SQS limit:
var publishOptions = new PublishOptions
{
Compression = CompressionAlgorithm.Gzip,
CompressionThresholdBytes = 10 * 1024, // 10 KB
};
var publisher = serviceProvider.GetRequiredService<ICloudMessagePublisher>();
await publisher.PublishAsync(new CloudMessage
{
Body = Encoding.UTF8.GetBytes("payload"),
}, CancellationToken.None);
Compressed messages include dispatch-compression and dispatch-body-encoding=base64 attributes; the SQS consumer automatically decodes them.
Supported compression algorithms for SQS payloads are Gzip, Deflate, and Brotli. Snappy is not supported.
services.AddAwsSqs(options =>
{
options.MaxRetries = 3; // AWS SDK retry count
options.RequestTimeout = TimeSpan.FromSeconds(30); // Request timeout
options.ValidateOnStartup = true; // Validate queue exists on startup
});
services.Configure<DlqOptions>(options =>
{
options.DeadLetterQueueUrl = new Uri("https://sqs.us-east-1.amazonaws.com/123456789/my-dlq");
options.MaxRetries = 3; // Max retries before DLQ
options.RetryDelay = TimeSpan.FromMinutes(5); // Delay between retries
options.UseExponentialBackoff = true; // Exponential backoff
options.MaxMessageAge = TimeSpan.FromDays(14); // Max message age to process
// Archive options
options.ArchiveFailedMessages = true;
options.ArchiveLocation = "s3://my-bucket/dlq-archive/";
// Automatic redrive
options.EnableAutomaticRedrive = true;
options.AutomaticRedriveInterval = TimeSpan.FromHours(1);
});
services.AddAwsSqs(options =>
{
options.EnableEncryption = true;
options.KmsMasterKeyId = "alias/my-key"; // KMS key alias or ARN
options.KmsDataKeyReusePeriodSeconds = 300; // Data key reuse period (60-86400)
});
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"kms:GenerateDataKey",
"kms:Decrypt"
],
"Resource": "arn:aws:kms:us-east-1:123456789:key/my-key-id"
}
]
}
services.AddHealthChecks()
.AddCheck<SqsHealthCheck>("sqs", tags: new[] { "ready", "messaging" });
services.Configure<SqsHealthCheckOptions>(options =>
{
options.Timeout = TimeSpan.FromSeconds(5);
options.QueueUrl = "https://sqs.us-east-1.amazonaws.com/123456789/my-queue";
});
public class SqsHealthCheck : IHealthCheck
{
private readonly IAmazonSQS _sqsClient;
private readonly AwsSqsOptions _options;
public async Task<HealthCheckResult> CheckHealthAsync(
HealthCheckContext context,
CancellationToken cancellationToken = default)
{
try
{
var response = await _sqsClient.GetQueueAttributesAsync(
_options.QueueUrl?.ToString(),
new List<string> { "ApproximateNumberOfMessages" },
cancellationToken);
var messageCount = int.Parse(
response.Attributes["ApproximateNumberOfMessages"]);
return messageCount > 10000
? HealthCheckResult.Degraded($"Queue depth: {messageCount}")
: HealthCheckResult.Healthy($"Queue depth: {messageCount}");
}
catch (Exception ex)
{
return HealthCheckResult.Unhealthy("SQS unreachable", ex);
}
}
}
VisibilityTimeout based on message processing timeservices.AddAwsSqs(options =>
{
// High-throughput configuration
options.MaxNumberOfMessages = 10; // Max batch size
options.WaitTimeSeconds = TimeSpan.FromSeconds(20); // Long polling (reduces API calls)
options.VisibilityTimeout = TimeSpan.FromMinutes(5); // 5 minutes for slow processing
options.BatchConfig = new BatchOptions
{
MaxBatchSize = 10,
MaxBatchWaitTime = TimeSpan.FromMilliseconds(50) // Faster batching
};
});
Key CloudWatch metrics to monitor:
| Metric | Description | Alert Threshold |
|---|---|---|
ApproximateNumberOfMessagesVisible |
Messages waiting | > 10,000 |
ApproximateNumberOfMessagesNotVisible |
In-flight messages | > VisibilityTimeout |
ApproximateAgeOfOldestMessage |
Message age | > retention period / 2 |
NumberOfMessagesSent |
Send rate | Baseline deviation |
NumberOfMessagesDeleted |
Process rate | < send rate (backlog growing) |
WaitTimeSeconds = TimeSpan.FromSeconds(20)) to reduce API callsservices.AddAwsSns(options =>
{
options.TopicArn = "arn:aws:sns:us-east-1:123456789:my-topic";
options.Region = "us-east-1";
});
// Publisher uses SNS
services.AddAwsSns(options =>
{
options.TopicArn = "arn:aws:sns:us-east-1:123456789:orders-topic";
});
// Multiple consumers subscribe SQS queues to the topic
// Configure in AWS Console or via CloudFormation
services.AddAwsEventBridge(options =>
{
options.EventBusName = "my-event-bus";
options.Region = "us-east-1";
options.DefaultSource = "my-application";
options.DefaultDetailType = "dispatch.event";
options.EnableArchiving = true;
options.ArchiveName = "my-event-archive";
options.ArchiveRetentionDays = 7;
});
Amazon.SQS.AmazonSQSException: Access to the resource is denied.
Solutions:
Amazon.SQS.AmazonSQSException: The specified queue does not exist.
Solutions:
.fifo suffixMessages keep reappearing after processing.
Solutions:
VisibilityTimeout if processing takes longerAmazon.SQS.AmazonSQSException: Message has expired
Solutions:
VisibilityTimeout to exceed processing timeChangeMessageVisibility for long-running tasksEnable detailed logging for troubleshooting:
{
"Logging": {
"LogLevel": {
"Excalibur.Dispatch.Transport.AwsSqs": "Debug",
"Amazon": "Warning",
"Amazon.SQS": "Information"
}
}
}
Enable AWS SDK logging:
AWSConfigs.LoggingConfig.LogTo = LoggingOptions.Console;
AWSConfigs.LoggingConfig.LogResponses = ResponseLoggingOption.OnError;
Use AWS CLI to test:
aws sqs receive-message --queue-url https://sqs.us-east-1.amazonaws.com/123456789/my-queue
Check CloudWatch Logs for Lambda-based consumers
Use X-Ray for distributed tracing
LocalStack logs for local development issues
services.AddAwsSqs(options =>
{
// Connection
options.QueueUrl = new Uri("https://sqs.us-east-1.amazonaws.com/123456789/my-queue");
options.Region = "us-east-1";
options.ServiceUrl = null; // Custom endpoint (LocalStack, etc.)
options.UseLocalStack = false;
options.LocalStackUrl = new Uri("http://localhost:4566");
// Authentication
options.Credentials = null; // Uses default credential chain
// Queue type
options.UseFifoQueue = false;
options.ContentBasedDeduplication = false;
// Polling
options.MaxNumberOfMessages = 10;
options.WaitTimeSeconds = TimeSpan.FromSeconds(20);
options.VisibilityTimeout = TimeSpan.FromSeconds(30);
// Message settings
options.MessageRetentionPeriod = 345600; // 4 days
// Reliability
options.MaxRetries = 3;
options.RequestTimeout = TimeSpan.FromSeconds(30);
options.ValidateOnStartup = true;
options.EnableDeduplication = false;
// Encryption
options.EnableEncryption = false;
options.KmsMasterKeyId = null;
options.KmsDataKeyReusePeriodSeconds = 300;
});
// Dead Letter Queue
services.Configure<DlqOptions>(options =>
{
options.DeadLetterQueueUrl = new Uri("https://sqs.us-east-1.amazonaws.com/123456789/my-dlq");
options.MaxRetries = 3;
options.RetryDelay = TimeSpan.FromMinutes(5);
options.UseExponentialBackoff = true;
options.MaxMessageAge = TimeSpan.FromDays(14);
options.ArchiveFailedMessages = true;
options.ArchiveLocation = "s3://bucket/archive/";
options.BatchSize = 10;
options.EnableAutomaticRedrive = false;
options.AutomaticRedriveInterval = TimeSpan.FromHours(1);
});
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on Excalibur.Dispatch.Transport.AwsSqs:
| Package | Downloads |
|---|---|
|
Excalibur.Dispatch.Aws
Experience metapackage bundling Excalibur.Dispatch with AWS SQS transport. Provides a single AddDispatchAws() call for the common AWS messaging scenario. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0-alpha.208 | 47 | 6/11/2026 |
| 3.0.0-alpha.207 | 46 | 6/11/2026 |
| 3.0.0-alpha.205 | 49 | 6/10/2026 |
| 3.0.0-alpha.204 | 59 | 6/8/2026 |
| 3.0.0-alpha.203 | 59 | 6/8/2026 |
| 3.0.0-alpha.202 | 58 | 6/8/2026 |
| 3.0.0-alpha.201 | 54 | 6/8/2026 |
| 3.0.0-alpha.199 | 50 | 6/8/2026 |
| 3.0.0-alpha.198 | 59 | 5/28/2026 |
| 3.0.0-alpha.197 | 63 | 5/28/2026 |
| 3.0.0-alpha.194 | 57 | 5/20/2026 |
| 3.0.0-alpha.193 | 64 | 5/13/2026 |
| 3.0.0-alpha.192 | 50 | 5/13/2026 |
| 3.0.0-alpha.191 | 54 | 5/13/2026 |
| 3.0.0-alpha.189 | 55 | 5/12/2026 |
| 3.0.0-alpha.187 | 58 | 5/8/2026 |
| 3.0.0-alpha.185 | 59 | 5/7/2026 |
| 3.0.0-alpha.183 | 62 | 5/7/2026 |
| 3.0.0-alpha.182 | 63 | 5/6/2026 |
| 3.0.0-alpha.181 | 59 | 5/6/2026 |