-
Notifications
You must be signed in to change notification settings - Fork 154
Feature request: idempotent decorator for function methods #1304
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
Comments
We have decided to hold back the decorator and not include it in the beta release. Read more about why in #1375. |
EDIT: In the previous edit of this message I mistakenly referred to the deprecation of the Batch Processing decorator in Powertools for AWS (Python), now marked as "legacy", and mixed it with the Idempotency utility which has no plans of deprecating decorator-based usage. I regret the mistake and apologize for the confusion it might have caused. At the moment we are not planning on implementing the decorator for Idempotency in Powertools for AWS (TypeScript) but we are are open to reconsider this decision in the future if there's enough customer demand. For now we will remove it from the backlog. |
|
Use case
Users who write their Lambda functions as classes should be able to make any calls method idempotent via decorator.
Solution/User Experience
The
idempotentMethod
decorator should be able to decorate any class method of aLambdaInterface
class, bothasync
andsync
. The decorator should accept an object with mandatorypersistenceStore
anddataArgument
fields, as well as an optionalconfig
one. The former should be an instance of any class that extendsBasePersistenceLayer
, the second should be a string that represents the argument to be used for idempotency (in the decorated method), while the latter should be an instance of the classIdempotencyConfig
.Following the Powertools for Python implementation, the decorator should:
POWERTOOLS_IDEMPOTENCY_DISABLED
env variable has a truthy value (usingEnvironmentVariableService
)IdempotencyHandler
IdempotencyHandler.handle()
methodThis last step will ensure that the
IdempotencyHandler
will perform all the actions needed to make the function idempotent.Alternative solutions
No response
Acknowledgment
The text was updated successfully, but these errors were encountered: