-
Notifications
You must be signed in to change notification settings - Fork 33
feat: Add support for response hooks in idempotency utility #968
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
Conversation
- Introduce ResponseHook delegate to IdempotencyOptions and builder - Invoke response hook on idempotent responses in IdempotencyAspectHandler - Update documentation with usage examples and best practices for response hooks - Add integration tests for response hook execution and exception handling - Improve XML doc comments for builder and persistence store
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #968 +/- ##
========================================
Coverage 77.47% 77.47%
========================================
Files 271 271
Lines 10886 10900 +14
Branches 1284 1287 +3
========================================
+ Hits 8434 8445 +11
- Misses 2040 2041 +1
- Partials 412 414 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
/// <summary> | ||
/// Constructor of <see cref="IdempotencyOptions"/>. | ||
/// </summary> | ||
/// <param name="eventKeyJmesPath"></param> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sonar alerted for the constructor now having more that 7 arguments. Refactor to builder pattern.
/// </summary> | ||
private Func<object, AWS.Lambda.Powertools.Idempotency.Persistence.DataRecord, object> _responseHook; | ||
|
||
/// <summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now properties for builder pattern
Signed-off-by: Henrique Graca <[email protected]>
|
Issue number: #795
Summary
Changes
This pull request introduces a new "response hook" feature to the idempotency utility, allowing users to manipulate the returned data for idempotent operations. It adds configuration options, implements the hook logic in the idempotency handler.
Response Hook Feature
ResponseHook
delegate property to theIdempotencyOptions
class, enabling users to specify a function to modify responses for idempotent operations.IdempotencyAspectHandler.HandleForStatus
, ensuring the hook is called only for idempotent responses and gracefully handles exceptions or type mismatches.Configuration and Builder Updates
IdempotencyOptionsBuilder
with aWithResponseHook
method, allowing users to set the hook during configuration.User experience
Checklist
Please leave checklist items unchecked if they do not apply to your change.
Is this a breaking change?
RFC issue number:
Checklist:
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.