JSFiddle - React, Tailwind, and code Playground
JavaScript
// Create a connection
$cnn = new AMQPConnection();
$cnn->connect();
// Create a channel
$ch = new AMQPChannel($cnn);
$i = 0;
while(true) //it will exit on line 36
{
echo "Creating queue " . $i . "\n";
$i++;
// Create a new queue
$flags = AMQP_NOPARAM | AMQP_PASSIVE;
$q = new AMQPQueue($ch);
$q->setName('inexistent_queue');
$q->setFlags($flags);
try
{
$q->declare();
}
catch (Exception $e)
{
//queue does not exist so we get an error and the channel gets disconnected
//amqp_queue.c line 711
echo ("ERROR: " . $e->getMessage() . " " . $e->getFile() . ":".$e->getLine());
if (!$ch->isConnected()) {
// $ch->close(); //method not implemented
try
{
$ch = new AMQPChannel( $cnn );
}
catch (Exception $e)
{
//no more channels left so we can't create a new one
echo ("ERROR: " . $e->getMessage() . " " . $e->getFile() . ":".$e->getLine());
exit;
}
}
}
}