Skip to content

Commit 1a1d08d

Browse files
heitorlessarafaelgsr
authored andcommitted
docs(idempotency): new sequence flow when idempotency key is optional (aws-powertools#2480)
1 parent fbcfc36 commit 1a1d08d

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Diff for: docs/utilities/idempotency.md

+30
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,36 @@ sequenceDiagram
649649
<i>Idempotent request during and after Lambda timeouts</i>
650650
</center>
651651

652+
#### Optional idempotency key
653+
654+
<center>
655+
```mermaid
656+
sequenceDiagram
657+
participant Client
658+
participant Lambda
659+
participant Persistence Layer
660+
alt request with idempotency key
661+
Client->>Lambda: Invoke (event)
662+
Lambda->>Persistence Layer: Get or set idempotency_key=hash(payload)
663+
activate Persistence Layer
664+
Note over Lambda,Persistence Layer: Set record status to INPROGRESS. <br> Prevents concurrent invocations <br> with the same payload
665+
Lambda-->>Lambda: Call your function
666+
Lambda->>Persistence Layer: Update record with result
667+
deactivate Persistence Layer
668+
Persistence Layer-->>Persistence Layer: Update record
669+
Note over Lambda,Persistence Layer: Set record status to COMPLETE. <br> New invocations with the same payload <br> now return the same result
670+
Lambda-->>Client: Response sent to client
671+
else request(s) without idempotency key
672+
Client->>Lambda: Invoke (event)
673+
Note over Lambda: Idempotency key is missing
674+
Note over Persistence Layer: Skips any operation to fetch, update, and delete
675+
Lambda-->>Lambda: Call your function
676+
Lambda-->>Client: Response sent to client
677+
end
678+
```
679+
<i>Optional idempotency key</i>
680+
</center>
681+
652682
## Advanced
653683

654684
### Persistence layers

0 commit comments

Comments
 (0)