Idempotency-Key header solves this: Routa guarantees that the same key produces at most one message.
Where it applies
The other write endpoints are designed to be safe to repeat (
disable and enable, for example), but they do not use the header. If you need to avoid retries in those cases, set maxRetries: 0 in the SDK.How to use it
Generate a unique key per logical message (a UUID v4, for example) before the first attempt, and send the same key on every retry.What happens in each case
In the SDK, when the call returns the result of an earlier attempt,
message._replayed is true.
Scope and lifetime
- The key is valid within the project, for this operation. Keys of different projects never collide.
- The record is kept for 24 hours. After that, repeating the key runs the operation again. The window is for retries, not for permanent deduplication.
- The body comparison ignores key order and whitespace in the JSON.