Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
162 views
in Technique[技术] by (71.8m points)

Can AWS SQS Service trigger API Gateway Proxy?

I working on a project and I need to trigger a proxy API whenever a message is received by the AWS SQS Service. I went through couple of articles and found that API to SQS is possible but did not find anything related to SQS triggering API Gateway. Can somebody please guide.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It is not possible to invoke a Lambda function asynchronously with a proxy integration. You can do this with Lambda non-proxy integration.

Set up asynchronous invocation of the backend Lambda function - https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-integration-async.html

Another workaround is to use another function that is invoked synchronously by the API Gateway API and have that function invoke the function that is part of the Spring boo application asynchronously using the Lambda Invoke API or SDK equivalent. https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html

For instance, you want Function A to be invoked asynchronously. To achieve this you would have the API Gateway API invoke Function B synchronously and have Function B invoke Function A asynchronously with the Invoke API.

Step Functions also cant be used as a workaround to invoke the REST APIs as this would not help. The Lambda functions are still invoked by the API Gateway API so you would still run into the limitation of a proxy integrations not being able to invoke Lambda asynchronously. You then decided that ECS would better suit your case as Lambda is not a good fit.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...