Bird
0
0

Which of the following is the correct sequence in the Outbox pattern?

easy📝 Conceptual Q12 of 15
Microservices - Advanced Patterns
Which of the following is the correct sequence in the Outbox pattern?
AWrite event to outbox table, commit transaction, then publish event
BPublish event, then write event to outbox table, then commit transaction
CCommit transaction, then write event to outbox table, then publish event
DPublish event and write to outbox table simultaneously outside transaction
Step-by-Step Solution
Solution:
  1. Step 1: Understand transaction order in Outbox pattern

    The event is first written to the outbox table inside the same transaction as the data change.
  2. Step 2: Commit transaction before publishing

    Only after the transaction commits successfully, a separate process reads and publishes the event.
  3. Final Answer:

    Write event to outbox table, commit transaction, then publish event -> Option A
  4. Quick Check:

    Outbox write before commit, publish after commit [OK]
Quick Trick: Events must be saved before commit, published after [OK]
Common Mistakes:
  • Publishing before commit causes lost events
  • Writing outbox after commit breaks atomicity
  • Trying to publish and write outside transaction

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Microservices Quizzes