Skip to content

feature: Idempotency module #717

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

Merged
merged 31 commits into from
Feb 16, 2022

Conversation

jeromevdl
Copy link
Contributor

Issue #, if available: #515

Description of changes:

  • Creation of a new module to handle idempotency of a Lambda function.
  • Creation of a new module to centralize json configuration, to be reused by idempotency and validation module, potentially others?

Checklist

Breaking change checklist

RFC issue #:

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

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

@msailes

This comment has been minimized.

@jeromevdl

This comment has been minimized.

@pankajagrawal16
Copy link
Contributor

pankajagrawal16 commented Jan 26, 2022

Project seems to have failing build when build on M1 Mac. Looks like the native lib does not support it ? Can be a problem

 (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/local/lib/libsqlite4java-osx-1.0.392.dylib' (no such file), '/usr/lib/libsqlite4java-osx-1.0.392.dylib' (no such file)
        at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)

Related post

@pankajagrawal16
Copy link
Contributor

General question. Should we use the CRT Http client by default? It's by far the fastest. It is the standard http client in the Kotlin SDK but is developer preview in the Java SDK.

Sorry I was still on UrlConnectionHttpClient (https://aws.amazon.com/blogs/developer/tuning-the-aws-java-sdk-2-x-to-reduce-startup-time/). If CRT is faster, we can use it. Any idea of the ETA of this "preview"?

I would recommend not to use the library which is in preview. It might be a an issue in adoption as well. We can definitely create a issue to upgrade to CRT once its out as GA

@jeromevdl
Copy link
Contributor Author

Project seems to have failing build when build on M1 Mac. Looks like the native lib does not support it ? Can be a problem

(fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e')), '/usr/local/lib/libsqlite4java-osx-1.0.392.dylib' (no such file), '/usr/lib/libsqlite4java-osx-1.0.392.dylib' (no such file)
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)

Yes I had the issue, I'm on M1. It works using another JDK (x86 64-bit):

java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)

@pankajagrawal16
Copy link
Contributor

pankajagrawal16 commented Jan 28, 2022

Yes I had the issue, I'm on M1. It works using another JDK (x86 64-bit):

java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)

Hmm I didnt try this specific version, But any other way not to force developing module on a specific java version for M1s ? I dont think its ideal to force a specific version. I am using latest corretto java 8. If there is no other way of configuring things differently, then may be we should re consider how the tests are written ?

@jeromevdl
Copy link
Contributor Author

Yes I had the issue, I'm on M1. It works using another JDK (x86 64-bit):

java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)

Hmm I didn't try this specific version, But any other way not to force developing module on a specific java version for M1s ? I dont think its ideal to force a specific version. I am using latest corretto java 8. If there is no other way of configuring things differently, then may be we should re consider how the tests are written ?

I will have a look at the comments on the issue, see if there are alternative solutions.

Happy to hear if you have other ideas on how to test DynamoDB locally without Dynamodb Local. Docker? I thought about that initially, but I remember having issues on Github as build are already executed in docker (docker in docker is often an issue).

Copy link
Contributor

@pankajagrawal16 pankajagrawal16 left a comment

Choose a reason for hiding this comment

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

Overall UX looks solid IMO.

I have few suggestions and nit picks, but it looks nice. Have a look and see if you agree.

Also we need to bring in module under CI/CD via git actions and include new module in all the workflow files where relevant.

import java.util.Map;
import java.util.stream.Collectors;

public class AppIdempotency implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
Copy link
Contributor

@pankajagrawal16 pankajagrawal16 Jan 28, 2022

Choose a reason for hiding this comment

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

I would avoid anything new to the examples project. see #726.

it will be great to have a working app with demo showcased here instead https://github.com/aws-samples/aws-lambda-powertools-examples

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can i just let it here and also add it to the other repo, now that it's done.

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean if you want to leave it here for now thats fine, as long as its added in the example repo too. Eventually examples folder will be gone from the project. We are tracking this against this issue #732

Copy link
Contributor Author

Choose a reason for hiding this comment

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

jeromevdl added a commit to jeromevdl/aws-lambda-powertools-java that referenced this pull request Feb 2, 2022
jeromevdl added a commit to jeromevdl/aws-lambda-powertools-java that referenced this pull request Feb 2, 2022
jeromevdl added a commit to jeromevdl/aws-lambda-powertools-java that referenced this pull request Feb 2, 2022
jeromevdl added a commit to jeromevdl/aws-lambda-powertools-java that referenced this pull request Feb 2, 2022
jeromevdl added a commit to jeromevdl/aws-lambda-powertools-java that referenced this pull request Feb 2, 2022
jeromevdl added a commit to jeromevdl/aws-lambda-powertools-java that referenced this pull request Feb 2, 2022
jeromevdl added a commit to jeromevdl/aws-lambda-powertools-java that referenced this pull request Feb 2, 2022
jeromevdl added a commit to jeromevdl/aws-lambda-powertools-java that referenced this pull request Feb 2, 2022
@jeromevdl
Copy link
Contributor Author

@msailes @pankajagrawal16 If you are ok with the code, I will create the doc, so we have everything in the same PR. I will also create (copy) the example in the other repo.

@pankajagrawal16
Copy link
Contributor

pankajagrawal16 commented Feb 3, 2022

@msailes @pankajagrawal16 If you are ok with the code, I will create the doc, so we have everything in the same PR. I will also create (copy) the example in the other repo.

It looks good to me that we can start writing docs for sure.

Issue related to building module on M1 mac with a specific java version still remains rite ? If we dont have an alternate solution for it now, I would say document rationale, related issues and workaround in the readme for powertools-idempotency module. With step by step details for getting it work.

I can use the same steps to validate if it works on my system. Sounds good ?

Copy link
Contributor

@pankajagrawal16 pankajagrawal16 left a comment

Choose a reason for hiding this comment

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

Docs looks solid too now. Some minor suggestion

Copy link
Contributor

@pankajagrawal16 pankajagrawal16 left a comment

Choose a reason for hiding this comment

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

Looks great to me. @msailes Would you like to give a pair of 👀 to the docs as well ?

Copy link
Contributor

@msailes msailes left a comment

Choose a reason for hiding this comment

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

This looks fantastic!

Copy link
Contributor

@pankajagrawal16 pankajagrawal16 left a comment

Choose a reason for hiding this comment

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

🚀

@pankajagrawal16 pankajagrawal16 merged commit fc95eed into aws-powertools:master Feb 16, 2022
@jeromevdl jeromevdl mentioned this pull request Feb 16, 2022
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants