![]() |
VOOZH | about |
dotnet add package CloudNimble.WebJobs.Extensions.Amazon --version 1.0.0-CI-20250608-015954
NuGet\Install-Package CloudNimble.WebJobs.Extensions.Amazon -Version 1.0.0-CI-20250608-015954
<PackageReference Include="CloudNimble.WebJobs.Extensions.Amazon" Version="1.0.0-CI-20250608-015954" />
<PackageVersion Include="CloudNimble.WebJobs.Extensions.Amazon" Version="1.0.0-CI-20250608-015954" />Directory.Packages.props
<PackageReference Include="CloudNimble.WebJobs.Extensions.Amazon" />Project file
paket add CloudNimble.WebJobs.Extensions.Amazon --version 1.0.0-CI-20250608-015954
#r "nuget: CloudNimble.WebJobs.Extensions.Amazon, 1.0.0-CI-20250608-015954"
#:package CloudNimble.WebJobs.Extensions.Amazon@1.0.0-CI-20250608-015954
#addin nuget:?package=CloudNimble.WebJobs.Extensions.Amazon&version=1.0.0-CI-20250608-015954&prereleaseInstall as a Cake Addin
#tool nuget:?package=CloudNimble.WebJobs.Extensions.Amazon&version=1.0.0-CI-20250608-015954&prereleaseInstall as a Cake Tool
CloudNimble.WebJobs.Extensions.Amazon brings the power of AWS services to Azure WebJobs! This package enables you to use Amazon SQS queues as triggers and bindings in your Azure Functions and WebJobs, allowing you to build cloud-agnostic solutions that leverage the best of both worlds.
dotnet add package CloudNimble.WebJobs.Extensions.Amazon
using Microsoft.Extensions.Hosting;
using CloudNimble.WebJobs.Extensions.Amazon;
var host = new HostBuilder()
.ConfigureFunctionsWorkerDefaults()
.ConfigureServices(services =>
{
// Add AWS services
services.AddDefaultAWSOptions(Configuration.GetAWSOptions());
services.AddAWSService<IAmazonSQS>();
// Add SQS extension
services.AddSQSExtension();
})
.Build();
host.Run();
public class OrderProcessor
{
[FunctionName("ProcessOrder")]
public async Task ProcessNewOrder(
[SQSTrigger("orders-queue")] Order order,
ILogger log)
{
log.LogInformation($"Processing order {order.Id} for {order.CustomerName}");
// Your business logic here
await ProcessOrderAsync(order);
}
}
public class Order
{
public string Id { get; set; }
public string CustomerName { get; set; }
public decimal Total { get; set; }
public List<OrderItem> Items { get; set; }
}
public class OrderService
{
[FunctionName("CreateOrder")]
public async Task<IActionResult> CreateOrder(
[HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequest req,
[SQS("orders-queue")] IAsyncCollector<Order> orderQueue)
{
var order = await req.GetBodyAsync<Order>();
// Send to SQS queue
await orderQueue.AddAsync(order);
return new OkObjectResult(new { orderId = order.Id });
}
}
[FunctionName("ProcessRawMessage")]
public async Task ProcessRawSQSMessage(
[SQSTrigger("raw-queue")] SQSMessage message,
ILogger log)
{
log.LogInformation($"MessageId: {message.MessageId}");
log.LogInformation($"Body: {message.Body}");
// Access message attributes
foreach (var attr in message.MessageAttributes)
{
log.LogInformation($"Attribute {attr.Key}: {attr.Value.StringValue}");
}
// Process based on content
if (message.MessageAttributes.ContainsKey("Type"))
{
await RouteMessageByType(message);
}
}
[FunctionName("ProcessBatch")]
public async Task ProcessMessageBatch(
[SQSTrigger("batch-queue", BatchSize = 10)] SQSMessage[] messages,
ILogger log)
{
log.LogInformation($"Processing batch of {messages.Length} messages");
var tasks = messages.Select(msg => ProcessSingleMessageAsync(msg));
await Task.WhenAll(tasks);
}
[FunctionName("ProcessDeadLetters")]
public async Task HandleDeadLetterMessages(
[SQSTrigger("orders-queue-dlq")] DeadLetterMessage<Order> deadLetter,
ILogger log)
{
log.LogWarning($"Dead letter received. Attempts: {deadLetter.DequeueCount}");
log.LogWarning($"Original error: {deadLetter.LastError}");
// Attempt remediation or alert operations team
await NotifyOperationsTeam(deadLetter);
}
services.Configure<SQSOptions>(options =>
{
// Polling configuration
options.MaxPollingInterval = TimeSpan.FromSeconds(20);
options.BatchSize = 10;
// Retry configuration
options.MaxDequeueCount = 5;
options.VisibilityTimeout = TimeSpan.FromMinutes(5);
// Processing configuration
options.MaxConcurrentCalls = 16;
options.PrefetchCount = 32;
});
Perfect for local development and testing:
services.AddDefaultAWSOptions(new AWSOptions
{
ServiceURL = "http://localhost:4566",
AuthenticationRegion = "us-east-1",
Credentials = new BasicAWSCredentials("test", "test")
});
Use application settings for flexible queue naming:
{
"Values": {
"OrdersQueue": "prod-orders-queue",
"OrdersQueueDLQ": "prod-orders-queue-dlq"
}
}
[FunctionName("ProcessOrder")]
public async Task ProcessOrder(
[SQSTrigger("%OrdersQueue%")] Order order)
{
// Queue name resolved from settings
}
The extension provides built-in metrics for monitoring:
These metrics integrate with Azure Monitor for alerting and autoscaling.
Moving from AWS Lambda to Azure Functions? It's easy:
AWS Lambda:
public async Task Handler(SQSEvent sqsEvent, ILambdaContext context)
{
foreach (var message in sqsEvent.Records)
{
await ProcessMessage(message.Body);
}
}
Azure Functions with this extension:
[FunctionName("ProcessMessages")]
public async Task Run([SQSTrigger("my-queue")] string message)
{
await ProcessMessage(message);
}
Q: Messages are not being processed
Q: Messages are being processed multiple times
Q: High latency when polling
We welcome contributions! Please see our Contributing Guide for details.
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by CloudNimble
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. 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 2 NuGet packages that depend on CloudNimble.WebJobs.Extensions.Amazon:
| Package | Downloads |
|---|---|
|
SimpleMessageBus.Publish.Amazon
SimpleMessageBus is a system for making applications more reliable and responsive to users by processing potentially long-running tasks out-of-band from the user's main workflow. It is designed to run either on-prem, or in the Microsoft Cloud, making it suitable for any application, and able to grow as your needs do. |
|
|
SimpleMessageBus.Dispatch.Amazon
SimpleMessageBus is a system for making applications more reliable and responsive to users by processing potentially long-running tasks out-of-band from the user's main workflow. It is designed to run either on-prem, or in the Microsoft Cloud, making it suitable for any application, and able to grow as your needs do. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-CI-20250608-015954 | 289 | 6/8/2025 |
| 1.0.0-CI-20250608-013940 | 139 | 6/8/2025 |
| 1.0.0-CI-20250608-012213 | 124 | 6/8/2025 |
| 1.0.0-CI-20250606-232418 | 95 | 6/7/2025 |