Skip to content

Commit 131e148

Browse files
author
Hossam Barakat
committed
Update the idempotency configuration
1 parent 0205b4d commit 131e148

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

examples/Idempotency/src/HelloWorld/Function.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,18 @@ private void Init(AmazonDynamoDBClient amazonDynamoDb, HttpClient httpClient)
6464
ArgumentNullException.ThrowIfNull(httpClient);
6565
var tableName = Environment.GetEnvironmentVariable("TABLE_NAME");
6666
ArgumentNullException.ThrowIfNull(tableName);
67-
Idempotency.Config()
68-
.WithConfig(IdempotencyConfig.Builder()
69-
.WithEventKeyJmesPath(
70-
"powertools_json(Body).address") // will retrieve the address field in the body which is a string transformed to json with `powertools_json`
71-
.WithExpiration(TimeSpan.FromSeconds(10))
72-
.Build())
73-
.WithPersistenceStore(
74-
DynamoDBPersistenceStore.Builder()
75-
.WithTableName(tableName)
76-
.WithDynamoDBClient(amazonDynamoDb)
77-
.Build())
78-
.Configure();
67+
68+
Idempotency.Configure(builder =>
69+
builder
70+
.WithOptions(optionsBuilder =>
71+
optionsBuilder
72+
.WithEventKeyJmesPath("powertools_json(Body).address") // will retrieve the address field in the body which is a string transformed to json with `powertools_json`
73+
.WithExpiration(TimeSpan.FromSeconds(10)))
74+
.UseDynamoDb(storeBuilder =>
75+
storeBuilder
76+
.WithTableName(tableName)
77+
.WithDynamoDBClient(amazonDynamoDb)
78+
));
7979
}
8080

8181
/// <summary>

0 commit comments

Comments
 (0)