Check: AMQP acknowledgment and duplicate safety

Knowledge check · self-test
Check: AMQP acknowledgment and duplicate safety
Review crash loss and the repeated tank command.
Review crash loss and the repeated tank command.
Checkpoint: Acknowledgment Timing
You now know:
- Auto-ack removes the message before processing, so a crash during message #50 loses that message even when processing normally takes 20ms.
- Manual ACK after successful work turns the same failure into redelivery instead of deletion.
- Prefetch limits the redelivery window but still requires idempotency for any duplicates that return.
Checkpoint: Protocol Fit
You now know:
- The chapter models AMQP overhead as 8–20 bytes; this is a simplified assumption, not its complete per-message cost.
- MQTT has a minimum 2-byte fixed header; total overhead, client memory and setup costs depend on the implementation and connection settings. MQTT often suits constrained sensors.
- The chapter's selection rule is constraint-led: choose the protocol that fits battery, bandwidth, latency, and routing needs.
Checkpoint: Duplicate Safety
You now know:
- Publisher confirms and manual ACKs give at-least-once delivery; they do not create exactly-once behavior by themselves.
- Idempotency keys let a consumer skip a redelivered command whose
message_idhas already executed. - The chemical-tank scenario shows why duplicates matter: a repeated 100ml command changes 300ml into 400ml without deduplication.
Back to AMQP Reliability: Persistence and Routing Patterns: Protect the Effect From Redelivery