[rabbitmq-discuss] PHP AmqpLib, rabbit hangs after a few hundred messages ?
anjelinio at taxibeat.com
Wed May 1 10:11:33 BST 2013
Hi guys, I'm having a serious problem with rabbit and the PHP AMQPLib
Our system is in essence a state workflow -> events are triggered when we
change state in any of our open sessions. We wanted to push processing of
those events away from our fron-facing web server, so decided on trying our
rabbit to create a pub-sub architecture for async processing of those
Now, those events are not a .. flood of events. We are getting around 10 -
50 per minute, and they are really small in size. We're using a fanout
exchange to push them to rabbit, and multi-process them using workers
running in another machine.
Yesterday was our first production test. We left it running for the whole
day, until at around 21:00, after more or less 12 hours running ok, rabbit
just stopped accepting messages. It was not dead, just not functional.
As I said, we're using the PhpAmqpLib client. We've written a couple of
helper classes, to create a Producer, a PubSubProducer ( the former uses a
topic exchange, the latter a fanout one ) and the corresponding Consumers.
Can anyone see something wrong in this ?
The source of the pub-sub producer is more or less this:
*public function __construct($exchange_name, $queue_name, $routing_key) *
$this->_exchange = $exchange_name;
$this->_queue = $queue_name;
$this->_routing_key = $routing_key;
*public function initialize()*
$config = QueueConfig::instance();
$this->_connection = new AMQPConnection($config->host, $config->port,
$config->user, $config->pwd, $config->vhost);
$this->_channel = $this->_connection->channel();
//echo "Registering Exchange: " . $this->_exchange;
*public function publish($message, $routing_key = null, $correlation_id =
$r_key = (null != $routing_key)? $routing_key : $this->_routing_key;
$properties = array('content_type' => 'text/plain', 'delivery_mode' =>
if(null != $correlation_id)
$properties['correlation_id'] = $correlation_id;
$msg = new AMQPMessage($message, $properties);
$this->_channel->basic_publish($msg, $this->_exchange, $r_key);
Thanks so much for any help guys, very very very much appreciated !
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rabbitmq-discuss