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
+78-2
Original file line number
Diff line number
Diff line change
@@ -121,7 +121,83 @@ You can quickly start by initializing the `DynamoDBPersistenceLayer` class and u
121
121
}
122
122
```
123
123
124
-
#### Choosing a payload subset for idempotency
124
+
### Idempotent_function decorator
125
+
126
+
Similar to [idempotent decorator](#idempotent-decorator), you can use `idempotent_function` decorator for any synchronous Python function.
127
+
128
+
When using `idempotent_function`, you must tell us which keyword parameter in your function signature has the data we should use via **`data_keyword_argument`** - Such data must be JSON serializable.
129
+
130
+
131
+
132
+
!!! warning "Make sure to call your decorated function using keyword arguments"
133
+
134
+
=== "app.py"
135
+
136
+
This example also demonstrates how you can integrate with [Batch utility](batch.md), so you can process each record in an idempotent manner.
137
+
138
+
```python hl_lines="4 13 18 25"
139
+
import uuid
140
+
141
+
from aws_lambda_powertools.utilities.batch import sqs_batch_processor
142
+
from aws_lambda_powertools.utilities.idempotency import idempotent_function, DynamoDBPersistenceLayer, IdempotencyConfig
0 commit comments