Hi guys...<div> </div><div> I am using rabbitmq server 2.3 .and java client 2.3.1</div><div> My application is in Scala. </div><div> There are about 8-9 Actors each has its own RabbitMQ QueueManager. and every actor in checking for message in each queue for every 1 minute </div>
<div><br></div><div> </div><div> in each Queue Manager the getting connection method is like </div><div><ol><li>private def getConnection {</li><li> try {</li><li> conn = FACTORY.newConnection</li><li> if (conn == null) {</li>
<li> <a href="http://logger.info">logger.info</a>(" FAILED TO CREATE CONNECTION WITH RABBITMQ ON " + FACTORY.getHost + ":" + FACTORY.getPort)</li><li> }</li><li> channel = conn.createChannel</li>
<li> if (channel == null) {</li><li> <a href="http://logger.info">logger.info</a>(" FAILED TO CREATE CHANNEL WITH RABBITMQ ON " + FACTORY.getHost + ":" + FACTORY.getPort)</li><li> }</li>
<li> if (conn != null) {</li><li> val durable = true</li><li> channel.exchangeDeclare(EXCHANGE, "direct", durable)</li><li> channel.queueDeclare(QUEUE, durable, false, false, null)</li>
<li> channel queueBind (QUEUE, EXCHANGE, ROUTING_KEY)</li><li> }</li><li> } catch {</li><li> case e: Exception => logger.error("Exception In Getting Connection to RabbitMQ ", e)</li><li> }</li>
<li><br></li><li> }</li></ol></div><div> </div><div><br></div><div> while publishing message on rabbitMQ Server . i am checking for null connection .if it is null then creating new connection</div><div> same for Getmessage .........</div>
<div><br></div><div> I never close channel and connection for Rabbitmq .</div><div><br></div><div> this work ............But afet some couple of hours it gives me exception </div><div> </div><div><br></div><div> <span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; "> Exception in Creating Rabbit MQ Connection</span></div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; ">java.net.ConnectException: Connection timed out<br> at java.net.PlainSocketImpl.socketConnect(Native Method)<br>
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:310)<br> at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:176)<br> at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:163)<br>
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)<br> at java.net.Socket.connect(Socket.java:546)<br> at java.net.Socket.connect(Socket.java:495)<br> at com.rabbitmq.client.ConnectionFactory.createFrameHandler(ConnectionFactory.java:338)<br>
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:376)<br> at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:399)</span><div><font class="Apple-style-span" face="arial, sans-serif"><br>
</font></div><div><font class="Apple-style-span" face="arial, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, sans-serif">Is there any possible solution for this type of exception <br></font><div>
<br></div><div> <br clear="all"><br>-- <br>Best Regards,<br>Sagar Varpe<br><br>
</div></div>