Skip to content
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

[Feature] Add a decorator that can handle "events.Records" as an array #25

Open
hassaku63 opened this issue Jul 1, 2020 · 1 comment

Comments

@hassaku63
Copy link

For events that receive records in array format, such as Kinesis/SQS, you may want to PUT the results of each event into DynamoDB.

In these cases, BatchWriter is used to write to the event, and it is more convenient in some cases to handle the records as they are.

  • Rename the existing SQS handler jeffy.handlers.sqs to another (e.g jeffy.handlers.sqs_each )
  • Re-define existing handler jeffy.handlers.sqs as the handler receives records as an array

or

  • Add handler to receive records as an array (e.g jeffy.handlers.sqs_batch / jeffy.handlers.sqs_records )

or

  • Add a decorator argument that tells the lambda handler receives an event object single record or arrayed records

As mentioned above, how about providing handlers that can be received both arrays/each element?

Related discussion: serverless-operations/jeffy-ja#1

@horike37
Copy link

horike37 commented Jul 1, 2020

@hassaku63
Thank you for the suggestion 👍 I agree with your idea.

Add a decorator argument that tells the lambda handler receives an event object single record or arrayed records

I personally prefer this option since we should keep the compatibility of Jeffy's previous versions.

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

No branches or pull requests

2 participants