1 December 2026 · 3 min read · Download as PDF
Publishing an event without losing the order
Web clients, partners and databases can all lead to AWS events. The hard part is committing the business change and publishing its event without a gap between them.
Part 2 of 6 · From Event to Outcome: AWS Messaging Patterns
Imagine the checkout API writes an order to its database, then calls EventBridge. The database succeeds; the event call fails. The customer sees a valid order, but fulfilment never hears about it. Reverse the order of those calls and the opposite failure is possible: consumers act on an order that was never committed. This is the dual-write problem, and changing Simple Queue Service (SQS) to Simple Notification Service (SNS) or EventBridge does not remove it.
Part 2 of 6 in From Event to Outcome, a series on AWS messaging patterns.
Where this fits. The customer has submitted an order. The Orders API owns whether the order was accepted, and the database commit records that decision. An outbox record gives the publisher a durable way to tell other systems what happened. This is the hand-off from the service roles in Part 1 to the routing decisions in Part 3.

TL;DR
- Give web, mobile and partner clients a deliberate ingress API. The client submits a command; it does not need to know every downstream queue and topic.
- For business changes written to a database, use a transactional outbox or an equivalent change data capture design so committed changes can be published reliably.
- Give each event an ID, type, version, timestamp and correlation ID, and define who can publish it.
- Treat a successful API response as an acceptance signal until downstream work has finished.
From different clients to one event
An app or partner can call an Orders API through API Gateway. The command handler authenticates the caller, validates the order, records it and returns an order ID. API Gateway also supports direct AWS service integrations, including EventBridge PutEvents, but direct publishing is a fit only when the API’s job is to accept an event and there is no local business transaction that must be committed with it.
An AWS service can generate its own event on the default bus. A scheduled job may publish a custom event. A SaaS partner can integrate with EventBridge, depending on the partner. Those are different ingress paths; they should still produce a documented event contract rather than asking every consumer to decode a client’s private request shape.
Close the database-to-event gap
The Orders service writes the order and an outbox record in the same database transaction. A separate publisher reads committed outbox records and sends OrderPlaced to the bus. AWS’s prescriptive guidance shows the same principle using an outbox table or change data capture such as DynamoDB Streams. A publisher can retry without inventing an order that was rolled back.
This does not make consumers exactly-once. The publisher may retry after the bus accepted an event but before it saw the response. Keep a stable application event ID in the event detail so consumers can recognise a repeat even when EventBridge assigns a new ID. With batched PutEvents, inspect each result, retry transient failures and investigate persistent ones. Verify the destination bus in deployment checks. AWS documents that an invalid bus name can produce an HTTP 200 response while the event is dropped.
What to put in the envelope
Keep business meaning in the event: OrderPlaced, an order ID and the facts subscribers need. Keep sensitive data and giant snapshots out unless they are necessary and permitted. Make the contract version visible. Add a correlation ID so the API request, outbox record, bus delivery and workflow execution can be traced together. Do not use the event ID as a substitute for a business idempotency key when the same order may create more than one legitimate event.
Next: route one committed event to several teams without tying their uptime together.
From Event to Outcome
- SQS, SNS and EventBridge: choose by the job
- Publishing an event without losing the order (you’re here)
- Fan-out without coupling every consumer
- The consumer is where reliability becomes real
- Events into Step Functions: rule, pipe or API?
- Fan-in, recovery and the end of the event story