BTP Event Mesh Part 3: Reliable Event Consumption
Consume events without losing them: persistent queues, acknowledgements after successful processing, redelivery on failure, maximum redelivery and dead message queues, consumer scaling, and monitoring queue depth.
Explanation
📌 KEY POINTS
✅ Events wait in queues until consumers acknowledge them.
✅ Acknowledge only after successful processing; failures lead to redelivery.
✅ After max redeliveries, messages move to a dead message queue for analysis.
✅ Monitor queue depth; scale consumers when backlog grows.
⚠️ Acknowledging before processing (auto-ack) loses events when the consumer crashes mid-processing.
━━━━━━━━━━━━━━━━━━━━
▶ WHERE WE ARE
Part 2 configured Event Mesh. Now reliability.
━━━━━━━━━━━━━━━━━━━━
▶ 1. PERSISTENCE
- Queues store events durably.
━━━━━━━━━━━━━━━━━━━━
▶ 2. ACKNOWLEDGEMENT
- Manual ack after success.
━━━━━━━━━━━━━━━━━━━━
▶ 3. REDELIVERY
- Retry behavior; limits.
━━━━━━━━━━━━━━━━━━━━
▶ 4. DEAD MESSAGES
- DMQ for poison messages.
━━━━━━━━━━━━━━━━━━━━
▶ 5. MONITORING & SCALING
- Queue depth, consumer count.
━━━━━━━━━━━━━━━━━━━━
▶ STEP BY STEP
- Consume with manual ack.
- Simulate a failure and observe redelivery.
- Configure max redelivery and DMQ.
✅ CHECKPOINT: poison event lands in DMQ; others continue.
Code example
===== CONSUMER LOGIC (pseudo) =====receive(msg)try { process(msg); ack(msg) }catch (e) { nack(msg) } // redelivered until max redelivery → dead message queue ===== QUEUE SETTINGS (examples) =====maxRedeliveryCount: 5 | deadMsgQueue: acme/orders/v1/crm-updates-dmq | message expiry as neededReal project scenario
A consumer auto-acknowledged events and then crashed during S/4 updates; several customer changes were lost. Switching to ack-after-success and adding a DMQ ensured no event was lost.
Common mistakes
- Auto-ack.
- No DMQ.
- Unlimited redelivery.
- No depth monitoring.
- Single consumer bottleneck.
Best practices
- Ack after success.
- DMQ.
- Redelivery limits.
- Depth alerts.
- Scale consumers.
Interview angle
Questions: "When should a consumer acknowledge?", "What is a dead message queue?", "How do you detect consumer problems?"
Strong answer: persistence, ack, redelivery, DMQ, monitoring.
Practice this lesson
Quick check
1. What typically happens to a message on an Event Mesh queue after it repeatedly fails delivery to consumers beyond the configured retry limit?
2. A consumer auto-acknowledged events and then crashed; changes were lost. What fixes this?
3. In SAP BTP Event Mesh, what is the key functional difference between a queue and a topic?
Interview questions
1. A production issue is reported in Event Mesh. What would you check first, and how would you troubleshoot it systematically?
Answer it in your own words first, then compare.
2. Events are occasionally lost or block processing. How do you make consumption reliable?
Answer it in your own words first, then compare.
Reference-verified: the steps are checked against official SAP documentation and tutorials, and object and field names in the sample code are checked for consistency. The code has not been compiled or run on an SAP system by ERPClimb. Syntax marked release-dependent varies by SAP release, so check it in your own system.
More lessons in this topic
- BTP Event Mesh Part 1: Why Event-Driven Integration
- BTP Event Mesh Part 2: Queues, Subscriptions and Security
- BTP Event Mesh Part 4: Event-Driven Architecture Design on BTP
- BTP Event Mesh Part 5: Delivery Guarantees, Ordering and Idempotent Consumers
- BTP Event Mesh Part 6: S/4HANA Business Events to Event Mesh