I can't seems to find this information anywhere or maybe I am not understanding it. In the publish/subscribe pattern in RabbitMQ, when a producer produces a message how does the consumer(s) know there is a new message in the queue?
Do the consumers constantly poll the queue to check whether there are any new messages or does the exchange 'push' notification to consumers saying there is a new message?
Consumer opens a network TCP connection and a channel to the RabbitMQ server.
A basic get will ask the server for a message: the message is pulled by the client from the server. If no message is available an empty response is sent to the client.
A consume will initiate a consumer scenario: server will push messages to the client.
So the consumer will know there is message because it can pull them (get) or they can be pushed to him (consume).
The exchange 'push' notification to consumers saying there is a new message?
The exchange are used for routing to queues. They pushes nothing as the consumers consume from queues.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With