RabbitMQ requires explicit acknowledgments from workers. If a worker crashes before acknowledging, RabbitMQ requeues the message so another worker can process it.
Setting prefetch_count to 1 tells RabbitMQ to send only one message at a time to a worker until it acknowledges the previous one, enabling fair task distribution.
The correct workflow is to first declare a durable queue, then publish persistent messages, configure workers with prefetch_count=1, and finally consume and acknowledge messages.
If auto_ack is true, RabbitMQ considers messages acknowledged as soon as sent, so if a worker crashes, messages are lost and not redelivered.
Durable queues and persistent messages prevent loss on broker restart. Manual acknowledgments ensure tasks are processed fully. Prefetch_count=1 balances load fairly.