I am just learning rabbitMQ and I was having a problem.
Using http://pecl.php.net/package/amqp version 1.4 (latest now) and RabbitMQ 3.3.1. We must use php5-fpm and persistent connections with amqp-> pconnect ().
After a while (I think 65,500 queries) there is a problem with stopping all records "
Failed to create channel. The connection has no open channel slots the rest
"
From what I read in the sources, is that every tcp connection has an auto-increment channel identifier that reaches its maximum value. This is due to the fact that each request must use a channel and cannot use the same channel (I could not find the path to the php-amqp channel classes to make it permanent), and scripts cannot communicate (use one and same instance channel as php object).
To reduce php-fpm's lifetime, this is not an option, as well as decoupling application-rabbitmq communication through another technology / library, etc.
Is there an easy way to fix this?
Theoretically, it should be one channel per stream (in this case, the php5-fpm working file works), but how can this be achieved using this library?The code I'm using now (it seems)
$this->con = new AMQPConnection(array(
'host' => $this->con_params['host'],
'port' => $this->con_params['port'],
'vhost' => $this->con_params['vhost'],
'login' => $this->con_params['user'],
'password' => $this->con_params['pass'],
'read_timeout' => 1,
'write_timeout' => 1,
'connect_timeout' => 1,
));
$this->con->pconnect();
$channel = new AMQPChannel($this->con);
$queue = new AMQPQueue($channel);
$queue->setName($queueName);
$queue->setFlags(AMQP_DURABLE);
$exchange = new AMQPExchange($channel);
$exchange->setName($exchangeName);
$exchange->setFlags(AMQP_DURABLE);
$exchange->setType(AMQP_EX_TYPE_DIRECT);
$this->queues[$queueName]->bind($exchangeName);
Thank!