RabbitMQ: None of the specified endpoints were reachable

jkyadav picture jkyadav · Jul 15, 2015 · Viewed 31.5k times · Source

My rabbitmq application is running on windows 2012 server, randomly I use to get this error.

Exception Type: RabbitMQ.Client.Exceptions.BrokerUnreachableException



None of the specified endpoints were reachable

   at RabbitMQ.Client.ConnectionFactory.CreateConnection()

   at Program.Main(String[] args)

Stream does not support writing.

   at System.IO.BufferedStream.EnsureCanWrite()

   at System.IO.BufferedStream.Write(Byte[] array, Int32 offset, Int32 count)

   at RabbitMQ.Client.Impl.SocketFrameHandler.SendHeader()

   at RabbitMQ.Client.Framing.Impl.Connection.StartAndTune()

   at RabbitMQ.Client.Framing.Impl.Connection.Open(Boolean insist)

   at RabbitMQ.Client.Framing.Impl.Connection..ctor(IConnectionFactory factory, Boolean insist, IFrameHandler frameHandler)

   at RabbitMQ.Client.Framing.Impl.ProtocolBase.CreateConnection(IConnectionFactory factory, Boolean insist, IFrameHandler frameHandler)

   at RabbitMQ.Client.ConnectionFactory.CreateConnection()

What could be the reason of failing the connection randomly, and automatically it starts connecting.

Can anyone help me out in this.

Answer

Peyman picture Peyman · Jul 15, 2015

It's hard to say whats the exactly problem, but one of the reason that cause to occur such issue is RabbitMQ heart beat, you can change this value. for more information you can check this linke Detecting Dead TCP Connections with Heartbeats

ConnectionFactory cf = new ConnectionFactory();

// set the heartbeat timeout to 60 seconds
cf.setRequestedHeartbeat(60);