You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add responseHook definition to IdempotencyConfig and call from IdempotencyHandler. Update idempotency example with an example use-case modifying API GW headers.
* This is our Lambda event handler. It accepts HTTP POST requests from API gateway and returns the contents of the given URL. Requests are made idempotent
76
+
* This is our Lambda event handler. It accepts HTTP POST requests from API gateway and returns the contents of the
77
+
* given URL. Requests are made idempotent
62
78
* by the idempotency library, and results are cached for the default 1h expiry time.
63
79
* <p>
64
80
* You can test the endpoint like this:
@@ -67,8 +83,10 @@ public App(DynamoDbClient client) {
* <li>First call will execute the handleRequest normally, and store the response in the idempotency table (Look into DynamoDB)</li>
71
-
* <li>Second call (and next ones) will retrieve from the cache (if cache is enabled, which is by default) or from the store, the handler won't be called. Until the expiration happens (by default 1 hour).</li>
86
+
* <li>First call will execute the handleRequest normally, and store the response in the idempotency table (Look
87
+
* into DynamoDB)</li>
88
+
* <li>Second call (and next ones) will retrieve from the cache (if cache is enabled, which is by default) or from
89
+
* the store, the handler won't be called. Until the expiration happens (by default 1 hour).</li>
72
90
* </ul>
73
91
*/
74
92
@Idempotent// The magic is here!
@@ -101,14 +119,14 @@ public APIGatewayProxyResponseEvent handleRequest(final APIGatewayProxyRequestEv
101
119
}
102
120
}
103
121
104
-
105
122
/**
106
123
* Helper to retrieve the contents of the given URL and return them as a string.
107
124
* <p>
108
125
* We could also put the @Idempotent annotation here if we only wanted this sub-operation to be idempotent. Putting
109
126
* it on the handler, however, reduces total execution time and saves us time!
Copy file name to clipboardExpand all lines: powertools-idempotency/powertools-idempotency-core/src/main/java/software/amazon/lambda/powertools/idempotency/IdempotencyConfig.java
Copy file name to clipboardExpand all lines: powertools-idempotency/powertools-idempotency-core/src/main/java/software/amazon/lambda/powertools/idempotency/internal/IdempotencyHandler.java
0 commit comments