Bird
0
0

Given this pseudocode for an Outbox pattern implementation, what will be the output if the transaction fails?

medium📝 Analysis Q13 of 15
Microservices - Advanced Patterns
Given this pseudocode for an Outbox pattern implementation, what will be the output if the transaction fails?
begin transaction
write data change
write event to outbox
commit transaction
publish event from outbox
ANeither data change nor event is saved or published
BEvent is published but data change is lost
CData change saved but event not published
DEvent published twice
Step-by-Step Solution
Solution:
  1. Step 1: Analyze transaction failure impact

    If the transaction fails, none of the writes (data change or outbox event) are committed to the database.
  2. Step 2: Understand event publishing dependency

    Since the event is published only after commit, no event will be published if commit fails.
  3. Final Answer:

    Neither data change nor event is saved or published -> Option A
  4. Quick Check:

    Failed transaction means no data or event saved [OK]
Quick Trick: Failed transaction means no commit, no event published [OK]
Common Mistakes:
  • Assuming event publishes despite transaction failure
  • Thinking data change saves without commit
  • Believing event publishes twice

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Microservices Quizzes