[rabbitmq-discuss] Consumers may hang after network instability

Busoli, Simone Simone.Busoli at ferrari.com
Fri Feb 17 16:08:16 GMT 2012


Alexey, you need to enable heartbeats to make sure that you detect network issues. It's an option on the ConnectionFactory class.

-----Original Message-----
From: rabbitmq-discuss-bounces at lists.rabbitmq.com [mailto:rabbitmq-discuss-bounces at lists.rabbitmq.com] On Behalf Of Alexey
Sent: venerdì 17 febbraio 2012 11:22
To: rabbitmq-discuss at lists.rabbitmq.com
Subject: [rabbitmq-discuss] Consumers may hang after network instability

Hello,

We are using 2.7.1 version of .NET client and 2.7.1 rabbitmq-server.
Several times we catched all consumers of rabbitmq server was hang after network instability (lost and reestablished connection or server with rabbitmq power cable unpluged)

Problem method is IModel.Close() or IConnection.Close() (sorry, I don't remember which is)

Parts of our code responded for connection below:

public void Connect()
{
	var cf = new ConnectionFactory
	{
		HostName = replica.EndPoint.Address.ToString(),
		Port = replica.EndPoint.Port,
		UserName = mqUsername,
		Password = mqPassword,
	};
	connection = cf.CreateConnection();
	Model = connection.CreateModel();
	Model.DeclareQueue(queueName);
	Model.BasicConsume(queueName, false, thisConsumerTag, true, false, null, this); }

public void Disconnect(){
	if (Model != null && Model.IsOpen) Model.Close(200, "Close on client initiative");
	if (connection != null && connection.IsOpen) connection.Close(200, "Close on client initiative", disconnectTimeout); }

Can anyone suggest a right way to close connection without chance to hang?
Would appreciate for help.
_______________________________________________
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

_________________________________________________________________________________________________________________
Questo messaggio è da intendersi esclusivamente ad uso del destinatario e può contenere informazioni che sono di natura privilegiata, confidenziale
o non divulgabile secondo le leggi vigenti. Se il lettore del presente messaggio non è il destinatario designato, o il dipendente/agente responsabile
per la consegna del messaggio al destinatario designato, si informa che ogni disseminazione, distribuzione o copiatura di questa comunicazione è 
strettamente proibita anche ai sensi del decreto legislativo 196/03 . Se avete ricevuto questo messaggio per errore, vi preghiamo di notificarcelo
immediatamente a mezzo e-mail di risposta e successivamente di procedere alla cancellazione di questa e-mail e relativi allegati dal vostro sistema.
_________________________________________________________________________________________________________________
This message is intended only for the use of the addressee and may contain information that is privileged, confidential and exempt from 
disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the 
message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly 
prohibited. If you have received this e-mail in error, please notify us immediately by return e-mail and delete this e-mail and all attachments from 
your system.
_________________________________________________________________________________________________________________




More information about the rabbitmq-discuss mailing list