[rabbitmq-discuss] PHP AmqpLib, rabbit hangs after a few hundred messages ?

Angelos Karantzalis 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 
client. 

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 
events. 

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();

     if(null!=$this->_exchange)

    {

        //echo "Registering Exchange: " . $this->_exchange;

        $this->_channel->exchange_declare($this->_exchange, 'fanout');

    }

}

*public function publish($message, $routing_key = null, $correlation_id = 
null)*

{

    $r_key = (null != $routing_key)? $routing_key : $this->_routing_key;

     $properties = array('content_type' => 'text/plain', 'delivery_mode' => 
2);

    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 ! 

Angel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130501/3536b008/attachment.htm>


More information about the rabbitmq-discuss mailing list