<div dir="ltr">Michael,<div><br></div><div>Actually I am opening and closing connections quite a lot (once every ~3 RPC requests on average). Is that bad and I'm supposed to pool them?</div><div><br></div><div>The client code is (split into multiple methods actually, but roughly):</div>
<div><br></div><div> factory = new ConnectionFactory();<br></div><div><div> connection = factory.newConnection();</div><div><span class="" style="white-space:pre">        </span> channel = connection.createChannel();</div>
<div><br></div><div><span class="" style="white-space:pre">        </span> Map<String, Object> arguments = new HashMap<String, Object>();</div><div><span class="" style="white-space:pre">        </span> arguments.put("x-expires", 10*60*1000); // 10 min</div>
<div><span class="" style="white-space:pre"> r</span>eplyQueueName = channel.queueDeclare("", false, true, true, arguments).getQueue();<span class="" style="white-space:pre">        </span> </div><div><span class="" style="white-space:pre">        </span> </div>
<div><span class="" style="white-space:pre">        </span> consumer = new QueueingConsumer(channel);</div><div><span class="" style="white-space:pre">        </span> channel.basicConsume(replyQueueName, true, consumer);</div></div>
<div><br></div><div><div> String response = null;</div><div><span class="" style="white-space:pre">        </span> String corrId = UUID.randomUUID().toString();</div><div><br></div><div><span class="" style="white-space:pre">        </span> BasicProperties props = new BasicProperties.Builder()</div>
<div><span class="" style="white-space:pre">        </span> <span class="" style="white-space:pre">        </span>.correlationId(corrId) </div><div><span class="" style="white-space:pre">        </span> <span class="" style="white-space:pre">        </span>.expiration(DEFAULT_TIMEOUT + "") </div>
<div><span class="" style="white-space:pre">        </span> <span class="" style="white-space:pre">        </span>.replyTo(replyQueueName)</div><div><span class="" style="white-space:pre">        </span> <span class="" style="white-space:pre">        </span>.build();</div>
<div><span class="" style="white-space:pre">        </span> </div><div><span class="" style="white-space:pre">        </span> channel.basicPublish("", queueName, props, message.getBytes()); </div></div><div><br></div><div>
while (true) {</div><div><span class="" style="white-space:pre">        </span> QueueingConsumer.Delivery delivery = null;</div><div><span class="" style="white-space:pre">                        </span>try {</div><div><span class="" style="white-space:pre">                                </span>delivery = consumer.nextDelivery(100);</div>
<div><span class="" style="white-space:pre">                        </span>} catch (InterruptedException e) {}</div><div><span class="" style="white-space:pre">                        </span></div><div><span class="" style="white-space:pre">                        </span>if (delivery == null) {</div>
<div><span style="white-space:pre"> </span>continue;<br></div><div><span class="" style="white-space:pre">                        </span>}<span class="" style="white-space:pre">                                </span><br></div><div><span class="" style="white-space:pre">                        </span></div>
<div><span class="" style="white-space:pre">        </span> if (delivery.getProperties().getCorrelationId().equals(corrId)) {</div><div><span class="" style="white-space:pre">        </span> response = new String(delivery.getBody());<span class="" style="white-space:pre">        </span> </div>
<div><span class="" style="white-space:pre">        </span> break;</div><div><span class="" style="white-space:pre">        </span> } else {</div><div><span class="" style="white-space:pre">        </span> <span class="" style="white-space:pre">        </span>continue;<br>
</div><div><span class="" style="white-space:pre">        </span> }</div><div><span class="" style="white-space:pre">        </span> }</div><div><br></div><div><div><span class="" style="white-space:pre">        </span>if (connection != null)</div>
<div>connection.abort(); // .close seemed to hang at com.rabbitmq.client.impl.ChannelN.close(ChannelN.java:492) -> com.rabbitmq.utility.BlockingCell.get(BlockingCell.java:50)</div></div><div><br></div><div><br></div></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Sep 8, 2013 at 9:11 PM, Michael Klishin <span dir="ltr"><<a href="mailto:michael@rabbitmq.com" target="_blank">michael@rabbitmq.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">John M.:<br>
<br>
> I've reviewed the Rabbit logs and the only kind of errors I find there are:<br>
><br>
> =ERROR REPORT==== 6-Sep-2013::21:36:59 ===<br>
> closing AMQP connection <0.3105.1297> (<a href="http://10.118.69.132:42582" target="_blank">10.118.69.132:42582</a> -> <a href="http://10.12.111.134:5672" target="_blank">10.12.111.134:5672</a>):<br>
> {handshake_timeout,frame_header}<br>
<br>
John,<br>
<br>
Can you post a snippet of your code that demonstrates what operations lead<br>
[presumably] to this error? Is it possible that you are opening and closing connections<br>
constantly or only creating and deleting reply queues?<br>
<span class="HOEnZb"><font color="#888888"><br>
MK<br>
<br>
<br>
<br>
</font></span></blockquote></div><br></div>