From 7d4f1d6cd80cafeef9ff5bbaf06d1f0f2ae6c2be Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Fri, 16 Jun 2023 11:44:42 +0200 Subject: [PATCH] docs(idempotency): new sequence flow when idempotency key is optional --- docs/utilities/idempotency.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/utilities/idempotency.md b/docs/utilities/idempotency.md index 7bbb279a3e2..4caa91250c8 100644 --- a/docs/utilities/idempotency.md +++ b/docs/utilities/idempotency.md @@ -649,6 +649,36 @@ sequenceDiagram Idempotent request during and after Lambda timeouts +#### Optional idempotency key + +
+```mermaid +sequenceDiagram + participant Client + participant Lambda + participant Persistence Layer + alt request with idempotency key + Client->>Lambda: Invoke (event) + Lambda->>Persistence Layer: Get or set idempotency_key=hash(payload) + activate Persistence Layer + Note over Lambda,Persistence Layer: Set record status to INPROGRESS.
Prevents concurrent invocations
with the same payload + Lambda-->>Lambda: Call your function + Lambda->>Persistence Layer: Update record with result + deactivate Persistence Layer + Persistence Layer-->>Persistence Layer: Update record + Note over Lambda,Persistence Layer: Set record status to COMPLETE.
New invocations with the same payload
now return the same result + Lambda-->>Client: Response sent to client + else request(s) without idempotency key + Client->>Lambda: Invoke (event) + Note over Lambda: Idempotency key is missing + Note over Persistence Layer: Skips any operation to fetch, update, and delete + Lambda-->>Lambda: Call your function + Lambda-->>Client: Response sent to client + end +``` +Optional idempotency key +
+ ## Advanced ### Persistence layers