Skip to content

Conversation

@hossambarakat
Copy link
Contributor

@hossambarakat hossambarakat commented Oct 6, 2022

Issue number: #164

Summary

Changes

Introduce Idempotency package to convert Lambda functions into idempotent operations which are safe to retry.

User experience

This is a new package, Here is a summary of how to use the package

1- Install the package

dotnet add package AWS.Lambda.Powertools.Idempotency

2- Prepare DynamoDB table to store request and response details
3- Configure the Idempotency package using Idempotency.Configure
4- Add the Idempotent attribute on top of the function

public class Function
{
    public Function()
    {
        Idempotency.Configure(builder => builder.UseDynamoDb("idempotency_table"));
    }
    
    [Idempotent]
    public Task<string> FunctionHandler(string input, ILambdaContext context)
    {
        return Task.FromResult(input.ToUpper());
    }
}

Checklist

Please leave checklist items unchecked if they do not apply to your change.

Is this a breaking change? No

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.


View rendered docs/core/idempotency.md
View rendered libraries/src/AWS.Lambda.Powertools.Idempotency/README.md

@auto-assign auto-assign bot requested a review from sliedig October 6, 2022 07:19
@github-actions github-actions bot added the feature New features or minor changes label Oct 6, 2022
@hjgraca hjgraca linked an issue Mar 28, 2023 that may be closed by this pull request
2 tasks
@hjgraca hjgraca added the do-not-merge PRs that are blocked for varying reasons label May 9, 2023
@hjgraca hjgraca assigned hjgraca and unassigned amirkaws May 9, 2023
@codecov-commenter
Copy link

codecov-commenter commented May 19, 2023

Codecov Report

Patch coverage: 80.76% and project coverage change: +6.40 🎉

Comparison is base (569ed17) 62.54% compared to head (33de0e1) 68.94%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #163      +/-   ##
===========================================
+ Coverage    62.54%   68.94%   +6.40%     
===========================================
  Files           61       79      +18     
  Lines         2627     3433     +806     
===========================================
+ Hits          1643     2367     +724     
- Misses         984     1066      +82     
Flag Coverage Δ
unittests 68.94% <80.76%> (+6.40%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
....Powertools.Common/Core/PowertoolsLambdaContext.cs 98.33% <ø> (ø)
...cy/Exceptions/IdempotencyConfigurationException.cs 0.00% <0.00%> (ø)
...xceptions/IdempotencyInconsistentStateException.cs 0.00% <0.00%> (ø)
...Exceptions/IdempotencyPersistenceLayerException.cs 0.00% <0.00%> (ø)
...xceptions/IdempotencyAlreadyInProgressException.cs 33.33% <33.33%> (ø)
...ncy/Exceptions/IdempotencyItemNotFoundException.cs 33.33% <33.33%> (ø)
....Idempotency/Exceptions/IdempotencyKeyException.cs 33.33% <33.33%> (ø)
...tency/Exceptions/IdempotencyValidationException.cs 33.33% <33.33%> (ø)
...s.Idempotency/Internal/IdempotencyAspectHandler.cs 52.83% <52.83%> (ø)
...xceptions/IdempotencyItemAlreadyExistsException.cs 66.66% <66.66%> (ø)
... and 10 more

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@amirkaws amirkaws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks for your contribution.

@hjgraca hjgraca merged commit dba5e90 into aws-powertools:develop Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge PRs that are blocked for varying reasons feature New features or minor changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFC: Add Idempotency Package

4 participants