how to handle connection.block "low memory" for RabbitMQ in php

76 views
Skip to first unread message

Satya Bhan

unread,
Jul 24, 2015, 11:53:49 AM7/24/15
to php-amqplib-devel
I'm having trouble understanding how to deal with connection.block from RabbitMQ. When rabbit runs out of memory it does not fail on writes. The fwrite to the socket still returns with the correct number of bytes written even though the queue is actually being blocked. The only way to detect this is to read from the socket and process the connection.block (10, 60) command. The way I've seen this handled in the java client is that a separate thread is continuously polling reading for commands and processes the block. Unfortunately there isn't a way to do this in php. My only solution was to try to read the socket after every write but when the write is actually successful (connection is not blocked) the RabbitMQ doesn't return anything. So you need to wait for it to timeout and then proceed. This is not workable since it delays every single publish on the off chance of detecting when the connection is actually blocked.

I also realized from testing that once the connection is in blocking mode. It no longer accepts commands to close the channel/connection. Is that the correct behavior? I would like to get ideas on how to deal with the low memory/blocking (10,6) issue for RabbitMQ in php.

Thanks!
Reply all
Reply to author
Forward
0 new messages