冪等性トークンとは?
冪等性トークン(idempotency key とも呼ばれる)は、サーバーが同じ操作の再試行を認識できるように、クライアントがリクエストとともに送信する一意の識別子です。サーバーはトークンを結果とともに記録し、同じトークンが再度到着した場合はその保存済みの結果を返します。これにより、元のレスポンスが失われた場合でも再試行が安全になります。
なぜ重要か
ネットワークはレスポンスを失うためクライアントは再試行しますが、トークンがなければ再試行された支払いや注文が二重に処理される可能性があります。冪等性トークンは at-least-once 配信を実質的な exactly-once の結果へと変えます。
関連ガイド
What Is Exactly-Once Delivery?Exactly-once delivery is the guarantee that a message is processed one and only one time, with neither loss n…
What Is At-Least-Once Delivery?At-least-once delivery guarantees a message is delivered at least one time, accepting possible duplicates in…
What Is a Distributed Transaction?A distributed transaction spans multiple databases or services and must either commit everywhere or roll back…