IntegrationArchitect (Hardest)outboxplatform-eventsreliability
Architect transactional outbox pattern for reliable Salesforce event publishing
Real World Scenario
Platform Event publish succeeds but Salesforce DML rolls back leaving external subscribers acting on phantom order-created events.
Expected Answer
• Outbox custom object written in same Apex transaction as business DML
• Scheduled job or Queueable publishes Platform Events from outbox marking Published
• Subscriber idempotency handles duplicate if publish retried
• Outbox cleanup archived after 7-day publish confirmation
• Never publish Platform Event before business transaction commits
• Monitor outbox Pending depth alerting stuck publisher
• Alternative: Change Data Capture on outbox object for external poll
Follow-Up Questions & Answers
Click to expand — each follow-up includes a direct, interview-ready answer
Main difference: use case and scale. Outbox custom object written in same Apex transaction as business DML. Scheduled job or Queueable publishes Platform Events from outbox marking Published. Pick based on your integration pattern and team capability. Transactional outbox solves dual-write problem—essential when event accuracy equals database accuracy. Document the decision in an ADR and align with enterprise standards.
Architect Perspective
Transactional outbox solves dual-write problem—essential when event accuracy equals database accuracy.