orchestrating a REST request

0

I have a use case wherein a lambda receives a REST request from the client. It then will need to call some N lambdas (scatter) using REST API and then wait to hear back from each of the N lambdas to collect (gather) the responses, consolidate the responses and respond back to the client. I'm thinking of using a step function (using parallel flow?) along with callback pattern when calling each of the N lambdas. Can you please share your ideas, blogs, github demos etc? Error handling is also essential.

2개 답변
3

We have a workshop on the scatter gather pattern. It doesn't use step functions - https://catalog.us-east-1.prod.workshops.aws/workshops/e8738cf6-6eb0-4d1d-9e98-ae240d229535/en-US/scatter-gather

There is a blog that talks about dynamic parallelism in Step Functions - https://aws.amazon.com/blogs/aws/new-step-functions-support-for-dynamic-parallelism/

profile pictureAWS
전문가
답변함 2년 전
profile pictureAWS
전문가
Chris_G
검토됨 2년 전
0

If I understand correctly, the clients connect to a REST API in API Gateway which invokes a Lambda which calls N other Lambda, using a REST API.

If this is the case, you could simplify it by invoking a synchronous Express workflow directly from API Gateway (eliminating the first Lambda function). The workflow will use a Map state to invoke all other Lambda functions (eliminating the second REST API, and without a need for a callback). When the Map state finishes, you have all the results and you can combine them, either in the state machine itself or in another Lambda function, depending on what you need to do. The combined result will be sent back to API Gateway, which will use a Response mapping to filter the actual response sent the client.

profile pictureAWS
전문가
Uri
답변함 2년 전
  • Thank you! I will explore this further but pls share if there's an example or blog post around this technique.

  • This is a blog about synchronous workflows. This is a blog post about the Map state.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠