Repository navigation
Transports AWS SQS
Fully managed message queuing service for distributed data mapping with AWS infrastructure.
FxMap.Aws.Sqs integrates Amazon SQS with the FxMap framework, enabling efficient data transportation between distributed systems using SQS as the underlying communication layer.
Long polling and batch processing for efficient message handling
Creates queues following naming pattern: fxmap-{key-namespace}-{key-type-name}
Supports credentials, IAM roles, and LocalStack for testing
dotnet add package FxMap.Aws.SqsOr via Package Manager Console:
Install-Package FxMap.Aws.SqsSupported .NET versions: 8.0 and 9.0
Configure AWS SQS transport with explicit credentials:
using FxMap;
using FxMap.Aws.Sqs;
using Amazon;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddFxMap(cfg =>
{
cfg.AddEntitiesFromAssemblyContaining<SomeEntityAssemblyMarker>();
cfg.AddSqs(sqs =>
{
sqs.Region(RegionEndpoint.USEast1, credential =>
{
credential.AccessKeyId("your-access-key-id");
credential.SecretAccessKey("your-secret-access-key");
});
});
});
var app = builder.Build();
app.Run();When running on AWS infrastructure (EC2, ECS, Lambda), use IAM roles for automatic credential management:
builder.Services.AddFxMap(cfg =>
{
cfg.AddEntitiesFromAssemblyContaining<SomeEntityAssemblyMarker>();
cfg.AddSqs(sqs =>
{
// No explicit credentials needed - uses IAM role
sqs.Region(RegionEndpoint.USEast1);
});
});Use LocalStack to test SQS functionality locally without AWS:
builder.Services.AddFxMap(cfg =>
{
cfg.AddEntitiesFromAssemblyContaining<SomeEntityAssemblyMarker>();
cfg.AddSqs(sqs =>
{
sqs.Region(RegionEndpoint.USEast1, credential =>
{
credential.ServiceUrl("http://localhost:4566");
credential.AccessKeyId("test");
credential.SecretAccessKey("test");
});
});
});builder.Services.AddFxMap(cfg =>
{
cfg.AddEntitiesFromAssemblyContaining<SomeEntityAssemblyMarker>();
cfg.AddSqs(sqs =>
{
var region = RegionEndpoint.GetBySystemName(
builder.Configuration["AWS:Region"] ?? "us-east-1"
);
sqs.Region(region, credential =>
{
credential.AccessKeyId(builder.Configuration["AWS:AccessKeyId"]);
credential.SecretAccessKey(builder.Configuration["AWS:SecretAccessKey"]);
});
});
});FxMap automatically creates and manages SQS queues with a specific naming pattern:
fxmap-{key-namespace}-{key-type-name}
Built from the namespace and name of the distributed key type, lowercased, with dots turned into dashes. Example for MyApp.Keys.UserDistributedKey: fxmap-myapp-keys-userdistributedkey
fxmap-response-{machinename}-{guid}
Example: fxmap-response-webserver1-a1b2c3d4
Avoid creating queues with names matching FxMap's reserved patterns to prevent conflicts with the framework's automated queue management.
Register the entities and a data provider as usual, and add SQS. The service polls the request queue of each distributed key it owns, and no endpoint is needed:
using Amazon;
builder.Services.AddFxMap(cfg =>
{
cfg.AddEntitiesFromAssemblyContaining<UserConfig>();
cfg.AddSqs(sqs => sqs.Region(RegionEndpoint.USEast1));
})
.AddEntityFrameworkCore(c => c.AddDbContexts(typeof(UserDbContext)));Prefer IAM role-based authentication over hard-coded credentials for better security
Set up DLQs in AWS console for handling failed messages and debugging
Use CloudWatch to monitor queue depth, message age, and processing rates
Use LocalStack for local development and testing before deploying to AWS
Source: https://fxmapper.net/docs/transports/aws-sqs/ — the website is always the most up to date version.
Introduction
Getting Started
Configuration
- Service Registration
- Entities & Profiles
- Handlers
- Pipelines
- Strongly Typed IDs
- Error Handling
- Retry Policy
- Supervisor
- Telemetry
- Kestrel (HTTP/2)
- Analyzers
Expressions
- Overview
- Property Access
- Filters, Sorting & Paging
- Functions
- Aggregations
- Projections
- Coalesce & Ternary
- GroupBy
Data Providers
Transports
Integrations
Quality
AI Assistants
Migration
Release Notes