Define the local atomic boundary
The proposed design stores the business change and an event record in the same local transaction. A separate publisher reads events and forwards them. The work request remains discoverable after an application restart. This is not a single transaction spanning the database, broker, model and ERP.
Consider an illustrative order workflow in which AI analyses an incoming message. After review, a transaction stores the approved order version and an order-ready event. The model does not publish that event directly. Its output becomes input to a controlled application operation.
Events describe bounded facts
Record the event identifier, business object, object version, type, change time and schema version. The consumer must know whether it receives a complete snapshot or a notification requiring a source read. That choice affects availability, confidentiality and the interpretation of delayed messages.
Avoid placing entire documents and secrets in the outbox by default. A limited payload or secure reference may be sufficient. Establish retention with the data owner: otherwise a publication queue can become an unintended long-lived copy of sensitive information.
Publication may happen more than once
Consider a crash after the broker acknowledges publication but before the publisher marks the row as sent. The publisher cannot reliably infer the previous outcome. Repetition is possible, so the consumer needs idempotent handling and durable duplicate detection covering the event's useful lifetime.
The business effect and its processed marker also require coordination. Marking an event processed before performing the effect can lose work. Recording the marker after an effect that cannot recognise duplicates can repeat the effect. An external API therefore needs its own execution and reconciliation contract rather than an assumption that the outbox solves everything.
Ordering and object versions
| Risk | Design control |
|---|---|
| Duplicate event | Durable identifier and consumer deduplication |
| Delayed older version | Object-version check before updating |
| Unknown schema | Hold with an explicit migration path |
| Unavailable consumer | Retention, age alert and bounded retries |
Do not demand global ordering when the business only needs ordering within one order. A narrower guarantee can simplify scaling. When events are handled concurrently, the consumer must reject stale updates or deliberately reconstruct state from successive versions.
Treat schema evolution as a deployment decision. A consumer may encounter both old and new payloads during recovery. Define compatibility rules and retain enough information to determine how each event was interpreted. Reprocessing old history against an incompatible schema should fail visibly, rather than silently dropping fields.
Acceptance requires inconsistency tests
Stop the application after commit and before publication. Then stop the publisher after sending, and delay an older event behind a newer version. Each test should end with consistent source and destination state without duplicate business consequences. Message counts alone cannot establish that outcome.
Monitor the oldest unpublished record, publication throughput and schema failures. The integration owner needs a selective redelivery procedure and evidence that consumers recognise operations already completed.
Check competing publishers and retention
When two publishers can inspect the same row, establish a claim mechanism or deliberately accommodate duplicate publication. Avoid holding a long database transaction open during a broker connection merely to simplify coordination: that can turn an integration outage into transactional-system contention.
Align duplicate-marker retention with the maximum redelivery horizon. Deleting a marker while old messages remain eligible for replay can reintroduce duplicate effects. Test a publisher losing its acknowledgement while another instance takes over, then verify one reconciled business outcome. This is a cross-team operating contract, not an isolated database setting.
During schema changes, test new publishers against the previous consumer and replay old events after deployment. Production commonly contains both compatibility directions. Ignoring an unknown optional field may be safe; changing the meaning of an existing field needs an explicit contract decision.
Also deliver an event for an object cancelled after publication. Establish whether the consumer acts on a historical fact or must check current conditions before acting. Both interpretations can be valid in different workflows. Accidentally mixing them creates business consequences that transport-level delivery metrics will not reveal.
Connect systems with Geekforce
We design AI integrations around consistency, retries and business consequences. Together, we can examine where your systems write information and request downstream work, then establish a safer operational flow.


