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?
Balu
已提問 1 年前檢視次數 257 次
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
專家
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南