← Back to context

Comment by jameson

1 month ago

Could someone clarify on how it can achieve exactly-once processing with idempotency key?

Using the example they provided:

1. Validate payment

2. Check inventory

3. Ship order

4. Notify customer

I'm curious about case when one of the operation times out. The workflow engine needs to then either time out or it may even crash before receving a response

In this scenario, the only option for the workflow is to retry with the same idempotency key it used, but this may re-execute the failed operation which may have been succeeded in the prior run because workflow did not receive the response. The succeeded operations would skip because workflow has run completion record for same idempotency key. Is that correct?

> The succeeded operations would skip because workflow has run completion record for same idempotency key. Is that correct?

This sounds about right. But you need to make sure the service being called in that step is indeed idempotent, and will return the same response which it earlier couldn't in time.