From 44e696f4d004ef4588bd231bdd502a03b72f548a Mon Sep 17 00:00:00 2001 From: Renato Golia Date: Mon, 7 Nov 2022 16:57:17 +0100 Subject: [PATCH] Wired up SQS message handler --- SqsEventHandlerFunction/Function.cs | 20 ++++++++++++++++++- .../SqsEventHandlerFunction.csproj | 4 +++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/SqsEventHandlerFunction/Function.cs b/SqsEventHandlerFunction/Function.cs index d83a852..e922376 100644 --- a/SqsEventHandlerFunction/Function.cs +++ b/SqsEventHandlerFunction/Function.cs @@ -1,5 +1,7 @@ +using System.Collections.Generic; using Amazon.Lambda.Core; using Amazon.Lambda.SQSEvents; +using Amazon.SimpleNotificationService; using Kralizek.Lambda; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -11,8 +13,24 @@ namespace SqsEventHandlerFunction; public class Function : EventFunction { + protected override void Configure(IConfigurationBuilder builder) + { + builder.AddInMemoryCollection(new Dictionary + { + ["Options:TopicArn"] = "ARN of my SNS topic" + }); + } + protected override void ConfigureServices(IServiceCollection services, IExecutionEnvironment executionEnvironment) { - services.UseQueueMessageHandler(); + services.UseQueueMessageHandler().WithParallelExecution(); + + services.AddAWSService(); + + services.Configure(Configuration.GetSection("Options")); + + services.UseCustomMessageSerializer(); + + services.AddSingleton(); } } diff --git a/SqsEventHandlerFunction/SqsEventHandlerFunction.csproj b/SqsEventHandlerFunction/SqsEventHandlerFunction.csproj index 7a5ca9e..7901bfd 100644 --- a/SqsEventHandlerFunction/SqsEventHandlerFunction.csproj +++ b/SqsEventHandlerFunction/SqsEventHandlerFunction.csproj @@ -10,9 +10,11 @@ + - + + \ No newline at end of file