Fix the Marten projection from Exercise 17 to handle out-of-order events.
Learn how to build resilient Marten projections that work even when events arrive in any order.
Events arrive from three different streams (payment, merchant, and fraud check), but they all reference the same PaymentId. Your projection must:
- Collect data from all three event types
- Store them in a single
PaymentVerificationread model - Derive the payment verification status when all data is present
Decision logic:
- Reject if merchant failed
- Reject if fraud score > 0.75
- Reject if amount > 10000 AND fraud score > 0.5
- Otherwise approve
Same out-of-order context as Exercise 16: events can arrive in any order (e.g., from different RabbitMQ queues or Kafka topics). The projection from Exercise 17 assumes ordered events — run the test to see it fail.
Emit event when payment verification is completed. Use RaiseSideEffectsmethod from Marten projections