How do you make saga steps idempotent?
Give each step a stable operation ID, persist its status with a uniqueness constraint, and make repeated commands return the known result instead of applying the action again.
The question library
Explore practical questions, clear explanations, and code examples across developer technologies.
Showing 2593–2604 of 3610 questions
Give each step a stable operation ID, persist its status with a uniqueness constraint, and make repeated commands return the known result instead of applying the action again.
A timeout should move the workflow into an explicit state where the coordinator checks whether the step succeeded, retries safely, or initiates compensation.
A saga is often preferable when services own separate databases, operations span long periods, or global locks and distributed transaction support are impractical.
The inbox pattern records incoming event IDs durably before or alongside business processing so duplicate deliveries can be detected.
A transactional inbox/outbox service atomically records the incoming event as handled, updates local business state, and writes outgoing events to an outbox.
If the database transaction commits but acknowledgement fails, the broker may redeliver the message.
A publish timeout may mean the broker never accepted the message or accepted it but the acknowledgement was lost.
Replay-safe consumers separate event ingestion from irreversible side effects, use stable IDs and version-aware business rules, and record processing state.
Increase throughput by tuning batch size and linger, using compression, distributing keys across partitions, and ensuring broker disks and networks are not bottlenecks.
Reduce latency by minimizing unnecessary hops, tuning batching and acknowledgements to the required durability, keeping handlers efficient, and avoiding saturated downstream services.
Estimate partition count from target throughput per partition, required consumer parallelism, key distribution, and operational overhead, then validate with load tests.
Prefer storing large objects in object storage and publishing a reference with integrity metadata rather than sending huge payloads through the broker.