Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

None of the specified endpoints were reachable

Tags:

c#

.net

rabbitmq

There is intermittent issue in rabbitmq while publishing message from .net application. It is creating lots of noise in the system. I have tried googling but could not found root cause of an issue.

Here is the error I can see in application log,

None of the specified endpoints were reachable
Endpoints attempted:
------------------------------------------------
endpoint=amqp-0-9://localhost:5672, attempts=1
System.TimeoutException: Connection to amqp-0-9://localhost:5672 timed out
   at RabbitMQ.Client.Impl.SocketFrameHandler_0_9.Connect(TcpClient socket, AmqpTcpEndpoint endpoint, Int32 timeout)
   at RabbitMQ.Client.Impl.SocketFrameHandler_0_9..ctor(AmqpTcpEndpoint endpoint, ObtainSocket socketFactory, Int32 timeout)
   at RabbitMQ.Client.Framing.Impl.v0_9_1.ProtocolBase.CreateFrameHandler(AmqpTcpEndpoint endpoint, ObtainSocket socketFactory, Int32 timeout)
   at RabbitMQ.Client.ConnectionFactory.FollowRedirectChain(Int32 maxRedirects, IDictionary`2 connectionAttempts, IDictionary`2 connectionErrors, AmqpTcpEndpoint[]& mostRecentKnownHosts, AmqpTcpEndpoint endpoint)
================================================
Stack trace:
   at RabbitMQ.Client.ConnectionFactory.CreateConnection(Int32 maxRedirects)
   at RabbitMQ.Client.ConnectionFactory.CreateConnection()
like image 897
vishal savsani Avatar asked Oct 19 '22 03:10

vishal savsani


1 Answers

I have resolved this issue by making RabbitMQ Connection object singleton to make sure reuse connection instead of making new connection everytime.

like image 66
vishal savsani Avatar answered Nov 15 '22 05:11

vishal savsani