RabbitMQ In pub/sub is the consumer polling the queue for new messages or does the server push messages?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
In normal RabbitMQ consumption, the broker pushes messages to subscribed consumers. The consumer does not sit in a loop polling the queue for new messages in the usual pub/sub flow, although RabbitMQ also provides a pull-style API for special cases.
The Normal Pattern Is Broker Push
In RabbitMQ, producers publish to an exchange, the exchange routes messages to queues, and consumers subscribe to queues. Once a consumer is registered, the broker delivers messages over the open connection as they become available.
A typical Python pika consumer looks like this:
Here the application registers a callback, and RabbitMQ pushes messages to that consumer as they are ready.
Acknowledgements and Prefetch Matter
Push delivery does not mean the broker floods the consumer without control. RabbitMQ tracks acknowledgements and can limit in-flight work with prefetch.
That tells the broker not to send more than a certain number of unacknowledged messages to the consumer at once. So the delivery model is push, but it is controlled push with backpressure mechanisms.
This is one reason RabbitMQ works well for work queues and pub/sub consumers that need reliable processing instead of simple fire-and-forget delivery.
Polling Exists, but It Is Not the Usual Consumer Model
RabbitMQ also offers a pull-style operation named basic.get. That lets a client ask for one message explicitly.
This is closer to polling, but it is not the typical high-throughput or pub/sub pattern. It is usually reserved for simple scripts, tests, or special control flows where on-demand fetch is acceptable.
If you are building a normal consumer service, basic.consume with callbacks is the standard design.
What This Means for Pub/Sub Topology
In a pub/sub setup, producers usually publish to a fanout or topic-style exchange, and each subscribing service gets its own queue bound to that exchange. RabbitMQ still pushes messages to the consumer from the queue side, not from the exchange directly.
That distinction matters because:
- delivery guarantees are tracked per queue
- acknowledgements are made against queue deliveries
- consumers scale by queue-consumer relationships, not by polling the exchange
Common Pitfalls
The biggest mistake is thinking "push" means unlimited uncontrolled delivery. In practice, acknowledgements and prefetch are part of how RabbitMQ regulates flow to the consumer.
Another common issue is confusing exchanges with queues. Consumers do not subscribe directly to an exchange. They consume from queues that are bound to exchanges.
People also assume a message disappears as soon as it is pushed. With manual acknowledgements, the broker keeps track of whether processing actually completed.
Finally, using basic.get in place of a real consumer loop often leads to lower throughput and unnecessary latency. It works, but it is usually the wrong model for continuous consumption.
Summary
- In the normal RabbitMQ consumption model, the broker pushes messages to subscribed consumers.
- Consumers usually read from queues through
basic.consume, not by polling repeatedly. - Prefetch and acknowledgements control how much work is in flight.
- RabbitMQ does support pull-style access through
basic.get, but that is not the usual pub/sub pattern. - Think of RabbitMQ as push-based delivery with flow control rather than simple polling.
Related reading
- RabbitMQ install issue on Centos 5.5
- RabbitMQ installation Error
- RabbitMQ IOError Socket
- RabbitMQ Java client - How to sensibly handle exceptions and shutdowns?
- RabbitMQ Java Client Using DefaultConsumer vs QueueingConsumer
- rabbitmq list queues on all vhosts
- RabbitMQ Management Over HTTPS and Nginx
- RabbitMQ management returns 500 when trying to list queues

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.