I get the following in the rabbitMQ log
MQ log 2018-05-14 10:40:12.841 [info] <0.20724.9> accepting AMQP connection <0.20724.9> (xxx.xxx.xxx.xxx:57489 -> //xxx.xxx.xxx.xxx:5672) 2018-05-14 10:40:12.856 [info] <0.20724.9> connection <0.20724.9> .xxx.xxx.xxx:57489 -> xxx.xxx.xxx.xxx:5672): user 'Username' authenticated and granted access to vhost '/' 2018-05-14 10:40:12.856 [info] <0.20724.9> closing AMQP connection <0.20724.9> (xxx.xxx.xxx.xxx:57489 -> xxx.xxx.xxx.xxx:5672, vhost: '/', user: 'Username') 2018-05-14 10:40:14.728 [info] <0.20741.9> accepting AMQP connection <0.20741.9> (xxx.xxx.xxx.xxx:57491 -> xxx.xxx.xxx.xxx:5672) 2018-05-14 10:40:14.728 [info] <0.20741.9> connection <0.20741.9> (xxx.xxx.xxx.xxx:57491 -> xxx.xxx.xxx.xxx:5672): user 'Username' authenticated and granted access to vhost '/' 2018-05-14 10:40:14.744 [info] <0.20741.9> closing AMQP connection <0.20741.9> (xxx.xxx.xxx.xxx:57491 -> xxx.xxx.xxx.xxx:5672, vhost: '/', user: 'Username') 2018-05-14 10:40:14.884 [info] <0.20756.9> accepting AMQP connection <0.20756.9> (xxx.xxx.xxx.xxx:57493 -> xxx.xxx.xxx.xxx:5672) 2018-05-14 10:40:14.884 [info] <0.20756.9> connection <0.20756.9> (xxx.xxx.xxx.xxx:57493 -> xxx.xxx.xxx.xxx:5672): user 'Username' authenticated and granted access to vhost '/' 2018-05-14 10:40:14.900 [info] <0.20756.9> closing AMQP connection <0.20756.9> (xxx.xxx.xxx.xxx:57493 -> xxx.xxx.xxx.xxx:5672, vhost: '/', user: 'Username') 2018-05-14 10:40:16.756 [info] <0.20771.9> accepting AMQP connection <0.20771.9> (xxx.xxx.xxx.xxx:57495 -> xxx.xxx.xxx.xxx:5672) 2018-05-14 10:40:16.928 [info] <0.20774.9> accepting AMQP connection <0.20774.9> (xxx.xxx.xxx.xxx:57496 -> xxx.xxx.xxx.xxx:5672) 2018-05-14 10:40:36.350 [warning] <0.20771.9> closing AMQP connection <0.20771.9> (xxx.xxx.xxx.xxx:57495 -> xxx.xxx.xxx.xxx:5672): {handshake_timeout,frame_header} 2018-05-14 10:40:36.350 [warning] <0.20774.9> closing AMQP connection <0.20774.9> (xxx.xxx.xxx.xxx:57496 -> xxx.xxx.xxx.xxx:5672): {handshake_timeout,frame_header}
I have the following in my config
[
{handshake_timeout, 0},
].
as well as an environment variable heartbeat with a value of 0
my code is as follows
public static void Recieve()
{
var User = figurationManager.AppSettings["RabbitMQUserName"];
var Pass = ConfigurationManager.AppSettings["RabbitMQPass"];
var Server = ConfigurationManager.AppSettings["Server"];
var Port = Int32.Parse(ConfigurationManager.AppSettings["Port"]);
ConnectionFactory factory = new ConnectionFactory();
factory.UserName = User;
factory.Password = Pass;
factory.VirtualHost = "/";
factory.HostName = Server;
factory.Port = Port;
IConnection conn = factory.CreateConnection();
IModel channel = conn.CreateModel();
channel.BasicQos(0, 1, false);
channel.QueueDeclare(queue: "QueName",
durable: true,
exclusive: false,
autoDelete: false,
arguments: null);
//channel.ExchangeDeclare("amq.direct", ExchangeType.Direct);
channel.QueueBind("QueName", "amq.direct", "", null);
bool sent = true;
var consumer = new EventingBasicConsumer(channel);
consumer.Received += (ch, ea) =>
{
var body = ea.Body;
var message = Encoding.UTF8.GetString(body);
sent = Send(message);
if (sent)
{
channel.BasicAck(ea.DeliveryTag, true);
}
else
{
channel.BasicReject(ea.DeliveryTag, true);
}
};
String consumerTag = channel.BasicConsume("QueName", false`enter code here`, consumer);
};