Hi all,
I am new to RabbitMQ. I am using rabbitMQ for my application queuing with HA and clustering. As always my connection timed out. I lost my connections as well as the queue. I am frustrated with the issue for quite some time . Would this be useful if I try to send an impulse at a regular interval with this simple code snippet. The idea behind this is much simpler as I always want the connection to be busy at a regular interval, thus never dies.
please keep this in mind as I am undergoing with a new Rabbit server setup and It will take some time. My old one does not have any heartbeat facility. So for this time being I need to keep the connection alive.
require_once('application/libraries/rabbitmq/amqp.inc');
$host = $this->config->item('HOST');
$port = $this->config->item('PORT');
$user = $this->config->item('USER');
$password = $this->config->item('PASSWORD');
$vhost = $this->config->item('VHOST');
$connection = new AMQPConnection($host, $port, $user, $password, $vhost);
$channel = $connection->channel();
$exchange = $queue = 'ha-pacemaker';
$channel->queue_declare($queue, false, true, false, true);
$channel->exchange_declare($exchange, 'direct', false, true, false);
$channel->queue_bind($queue, $exchange);
$rabbitmq_data['send_email'] = du...@email.addr';
$msg_body = json_encode($rabbitmq_data);
$msg = new AMQPMessage($msg_body, array('content_type' => 'text/plain', 'delivery-mode' => 2));
$channel->basic_publish($msg, $exchange);
}
$channel->close();
$connection->close();
Does anyone have any better idea? Thanx in advance.