Skip to content

Add integration for setting up SQS event source for a Lambda function. #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 7, 2025

Conversation

normj
Copy link
Member

@normj normj commented Mar 11, 2025

Issue #, if available:
#41

Description of changes:
This is the Aspire integration for the PR aws/aws-lambda-dotnet#2008 that adds the SQS event source.

Here is an example configuring the .NET Aspire app host to have an SQS event source for a Lambda function. The queue url can come from either a plain string or a CloudFormation/CDK resource.

var builder = DistributedApplication.CreateBuilder(args);

var awsSdkConfig = builder.AddAWSSDKConfig().WithRegion(Amazon.RegionEndpoint.USWest2);

var cdkStackResource = builder.AddAWSCDKStack("AWSLambdaPlaygroundResources");
var sqsDemoQueue = cdkStackResource.AddSQSQueue("DemoQueue");

builder.AddAWSLambdaFunction<Projects.SQSProcessorFunction>("SQSProcessorFunction", "SQSProcessorFunction::SQSProcessorFunction.Function::FunctionHandler")
        .WithReference(awsSdkConfig)
        .WithSQSEventSource(sqsDemoQueue);

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@normj normj marked this pull request as draft March 11, 2025 17:24
@normj normj force-pushed the normj/testtool-sqs branch from 49cc63a to 5790641 Compare March 11, 2025 17:27
@normj normj marked this pull request as ready for review April 5, 2025 00:11
@normj normj requested review from philasmar and GarrettBeatty April 5, 2025 00:11
Comment on lines 3 to 7
"Mock Lambda Test Tool": {
"commandName": "Executable",
"commandLineArgs": "--port 5050",
"workingDirectory": ".\\bin\\$(Configuration)\\net8.0",
"executablePath": "%USERPROFILE%\\.dotnet\\tools\\dotnet-lambda-test-tool-8.0.exe"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove this line?

Copy link
Member Author

@normj normj Apr 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted. I also added a gitignore entry for playground launchsettings.json.

Comment on lines 9 to 12
"Aspire_ProcessorFunction": {
"commandName": "Executable",
"executablePath": "dotnet",
"commandLineArgs": "exec --depsfile ./SQSProcessorFunction.deps.json --runtimeconfig ./SQSProcessorFunction.runtimeconfig.json %USERPROFILE%\\.dotnet\\tools\\.store\\amazon.lambda.testtool\\0.9.999\\amazon.lambda.testtool\\0.9.999\\content\\Amazon.Lambda.RuntimeSupport\\net8.0\\Amazon.Lambda.RuntimeSupport.dll SQSProcessorFunction::SQSProcessorFunction.Function::FunctionHandler",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this is here by accident right? you only want the one below - the 0.10.0 version

"workingDirectory": ".\\bin\\$(Configuration)\\net8.0",
"executablePath": "dotnet"
},
"Mock Lambda Test Tool": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Contributor

@GarrettBeatty GarrettBeatty Apr 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this auto generated one from the aws toolkit will end up confusing customers - we should probably see about getting rid of this eventually sooner than later

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted

@GarrettBeatty
Copy link
Contributor

everything else seems fine to me. approving assuming the other comments are addressed

@normj normj merged commit 9553752 into dev Apr 7, 2025
5 checks passed
@normj normj deleted the normj/testtool-sqs branch April 7, 2025 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants