Skip to content

Commit 57f34c5

Browse files
authored
Merge pull request #758 from aws-powertools/docs/idempotency-prefix
chore: Update docs Idempotency custom prefix
2 parents 6deceb3 + 9da3e3f commit 57f34c5

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/utilities/idempotency.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,29 @@ If we were to treat the entire request as our idempotency key, a simple HTTP hea
253253
}
254254
```
255255

256+
### Custom key prefix
257+
258+
By default, the idempotency key is prefixed with `[ClassName].[DecoratedMethodName]#[PayloadHash]`.
259+
260+
You can customize this prefix by setting the `KeyPrefix` property in the Idempotency decorator:
261+
262+
```csharp hl_lines="9"
263+
public class Function
264+
{
265+
public Function()
266+
{
267+
var tableName = Environment.GetEnvironmentVariable("IDEMPOTENCY_TABLE_NAME");
268+
Idempotency.Configure(builder => builder.UseDynamoDb(tableName));
269+
}
270+
271+
[Idempotent(KeyPrefix = "MyCustomKeyPrefix")]
272+
public APIGatewayProxyResponse FunctionHandler(APIGatewayProxyRequest apigwProxyEvent, ILambdaContext context)
273+
{
274+
return TestHelper.TestMethod(apigwProxyEvent);
275+
}
276+
}
277+
```
278+
256279
### Lambda timeouts
257280

258281
???+ note

0 commit comments

Comments
 (0)