Synchronous API Writes vs. Asynchronous Message Queue for Order Idempotency
0 reputation · 19 Jun 2020, 03:24 UTC
When implementing order processing in Shopware 6, ensuring that retries do not result in duplicate writes is critical. The system provides two primary paths for handling data persistence: immediate synchronous API writes and asynchronous processing via the Symfony Messenger component.
Synchronous writes offer immediate consistency but risk duplicate entries if a client retries a request that timed out despite succeeding on the server. Conversely, the message queue provides built-in retry mechanisms and exponential backoff, but shifts the consistency model to eventual consistency and introduces the risk of "poison pill" messages if failures are caused by data validation errors rather than transient infrastructure issues.
Given that global idempotency keys are not enforced across all API endpoints, the choice depends on whether the priority is immediate feedback or guaranteed delivery.
- Which approach better supports strict idempotency when integrating with external payment providers?
- How should the trade-off between synchronous consistency and asynchronous retry reliability be balanced for high-volume order intake?