Prefetch (QoS) limita quanti messaggi non riconosciuti un consumer può tenere in sospeso contemporaneamente — controllando la distribuzione del lavoro e prevenendo che un consumer sia sopraffatto mentre altri rimangono inattivi. È importante per un'elaborazione equa ed efficiente dei messaggi.
Cosa fa il prefetch
PREFETCH (QoS - prefetch count) → limits the number of UNACKNOWLEDGED messages a consumer
can have at once:
→ without it → RabbitMQ may dispatch many messages to one consumer (it grabs a batch)
→ with prefetch=N → a consumer gets at most N unacked messages at a time (must ack to get more)
→ controls how messages are distributed and how much a consumer buffers
