SQS Step Function Poller without Lamda

0

Typical Pattern to execute Step function for an SQS Event is to create Lambda with SQS Event Source Mapping and run an express step function synchronously within Lambda. If step function fails, error can be thrown out of lambda, which keeps the message in SQS and will be retried by poller, after visibility timeout.

This process has one key disadvantage. During the step function process, Lambda also stays active and hence we will be paying for execution of both. Alternatives: If we execute step function asynchronously,

  • We can't use SQS + Lambda Retry, since we mark Lambda process as success and message is deleted from SQS.
  • We also can't use FIFO SQS, since message will be removed before the event is fully processed by step function and next one is queue with group id might be picked up right away.

Question:

  • Are there any alternate designs without writing our own SQS poller?
  • If we need to write a poller, how can we effortlessly scale , like AWS Event Source Poller does?
1개 답변
0

I don't think this is going to be easy either way: Either you write some custom code for the poller/waiter/asynchronous process (so there's complexity there as well as cost, maintenance, etc.) or you continue to do what you're doing (having the Lambda function wait - which is cost but far less complexity).

Yes, there are ways to do this: For example, you could have the Lambda function store the status of the SQS message in a database (DynamoDB for example) so that you can track the in-progress items; but now you're recreating the queue logic in a separate place.

You hint at something but don't directly say it: It sounds like you (a) need to process the messages in order and (b) only want to process a certain number at a time. Why is that? Is there a threshold load on a back-end system that can't be exceeded?

It might be possible to provide another solution if you could give more context to what you're trying to achieve.

profile pictureAWS
전문가
답변함 일 년 전

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

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

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

관련 콘텐츠