There is a demo consumer:
It loops as long as the channel has callbacks registered
while (count($ch->callbacks)) {
$ch->wait();
}
The thing is that I need to get not more than 100 messages from the queue for example. If there are only 80 for example it should return just 80 and exit loop.
Thanks
Would the following code work for you ?