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
Copy file name to clipboardExpand all lines: docs/utilities/idempotency.md
+9-13
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ classDiagram
52
52
53
53
## Getting started
54
54
55
-
We use Amazon DynamoDB as the default persistence layer in the documentation. If you prefer Redis, you can learn more from [this section](#redis-as-persistent-storage-layer-provider).
55
+
We use Amazon DynamoDB as the default persistence layer in the documentation. If you prefer Redis, you can learn more from [this section](#redis-cluster).
56
56
57
57
### IAM Permissions
58
58
@@ -80,7 +80,7 @@ To start, you'll need:
80
80
81
81
---
82
82
83
-
[Amazon DynamoDB](#dynamodb-table) or [Redis](#redis-as-persistent-storage-layer-provider)
83
+
[Amazon DynamoDB](#dynamodb-table) or [Redis](#redis-cluster)
@@ -126,7 +126,7 @@ Note that `fn_qualified_name` means the [qualified name for classes and function
126
126
127
127
##### Limitations
128
128
129
-
***DynamoDB restricts [item sizes to 400KB](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html#limits-items){target="_blank"}**. This means that if your annotated function's response must be smaller than 400KB, otherwise your function will fail. Consider [Redis](#redis-as-persistent-storage-layer-provider) as an alternative.
129
+
***DynamoDB restricts [item sizes to 400KB](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html#limits-items){target="_blank"}**. This means that if your annotated function's response must be smaller than 400KB, otherwise your function will fail. Consider [Redis](#redis-cluster) as an alternative.
130
130
131
131
***Expect 2 WCU per non-idempotent call**. During the first invocation, we use `PutItem` for locking and `UpdateItem` for completion. Consider reviewing [DynamoDB pricing documentation](https://aws.amazon.com/dynamodb/pricing/){target="_blank"} to estimate cost.
132
132
@@ -153,19 +153,19 @@ In both services and self-hosting Redis, you'll need to configure [VPC access](h
153
153
1. Replace the Security Group ID and Subnet ID to match your VPC settings.
154
154
2. Replace the Security Group ID and Subnet ID to match your VPC settings.
155
155
156
-
Once setup, you can find a quick start and advanced examples for Redis in [the persistent layers section](RedisCachePersistenceLayer).
156
+
Once setup, you can find a quick start and advanced examples for Redis in [the persistent layers section](#redispersistencelayer).
157
157
158
158
<!-- markdownlint-enable MD013 -->
159
159
160
160
### Idempotent decorator
161
161
162
162
For simple use cases, you can use the `idempotent` decorator on your Lambda handler function.
163
163
164
-
It will treat the entire event as an idempotency key. That is, the same event will return the previously stored result within a [configurable time window](#expiring-idempotency-records)_(1 hour, by default)_.
164
+
It will treat the entire event as an idempotency key. That is, the same event will return the previously stored result within a [configurable time window](#adjusting-expiration-window)_(1 hour, by default)_.
165
165
166
166
=== "Idempotent decorator"
167
167
168
-
!!! tip "You can also choose [one or more fields](#choosing-a-payload-subset-for-idempotency) as an idempotency key."
168
+
!!! tip "You can also choose [one or more fields](#choosing-a-payload-subset) as an idempotency key."
@@ -352,7 +352,7 @@ You can change this expiration window with the **`expires_after_seconds`** param
352
352
353
353
!!! note "You can skip this section if you are using the [`@idempotent` decorator](#idempotent-decorator)"
354
354
355
-
By default, we protect against [concurrent executions](#handling-concurrent-executions-with-the-same-payload) with the same payload using a locking mechanism. However, if your Lambda function times out before completing the first invocation it will only accept the same request when the [idempotency record expire](#expiring-idempotency-records).
355
+
By default, we protect against [concurrent executions](#handling-concurrent-executions-with-the-same-payload) with the same payload using a locking mechanism. However, if your Lambda function times out before completing the first invocation it will only accept the same request when the [idempotency record expire](#adjusting-expiration-window).
356
356
357
357
To prevent extended failures, use **`register_lambda_context`** function from your idempotency config to calculate and include the remaining invocation time in your idempotency record.
358
358
@@ -517,7 +517,7 @@ You can can easily integrate with [Batch](batch.md){target="_blank"} using the [
517
517
???+ "Choosing an unique batch record attribute"
518
518
In this example, we choose `messageId` as our idempotency key since we know it'll be unique.
519
519
520
-
Depending on your use case, it might be more accurate [to choose another field](#choosing-a-payload-subset-for-idempotency) your producer intentionally set to define uniqueness.
520
+
Depending on your use case, it might be more accurate [to choose another field](#choosing-a-payload-subset) your producer intentionally set to define uniqueness.
521
521
522
522
=== "Integration with Batch Processor"
523
523
@@ -968,10 +968,6 @@ When using response hooks to manipulate returned data from idempotent operations
968
968
969
969
## Compatibility with other utilities
970
970
971
-
### Batch
972
-
973
-
See [Batch integration](#batch-integration) above.
974
-
975
971
### JSON Schema Validation
976
972
977
973
The idempotency utility can be used with the `validator` decorator. Ensure that idempotency is the innermost decorator.
@@ -982,7 +978,7 @@ The idempotency utility can be used with the `validator` decorator. Ensure that
982
978
983
979
Make sure to account for this behavior, if you set the `event_key_jmespath`.
984
980
985
-
=== "Using Idempotency with JSONSchema Validation utility"
0 commit comments