Updated to&nbsp;amqp-client 3.1.0 but still same problem.<div><br></div><div>Tried to close channel instead od basicCancel.. same problem.&nbsp;</div><div><br></div><div><br><br>On Tuesday, May 21, 2013 4:02:59 PM UTC-7, Kristian Lind wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div>&lt;dependency&gt;</div><div><span style="white-space:pre">        </span>&lt;groupId&gt;com.rabbitmq&lt;/<wbr>groupId&gt;</div><div><span style="white-space:pre">        </span>&lt;artifactId&gt;amqp-client&lt;/<wbr>artifactId&gt;</div><div><span style="white-space:pre">        </span>&lt;version&gt;3.0.4&lt;/version&gt;</div><div>&lt;/dependency&gt;</div><div><br></div><div><span style="color:rgb(68,68,68);font-family:Verdana,sans-serif;font-size:12px;text-align:right">RabbitMQ 3.0.2, Erlang R16A</span><br></div><div><span style="color:rgb(68,68,68);font-family:Verdana,sans-serif;font-size:12px;text-align:right"><br></span></div><div><span style="color:rgb(68,68,68);font-family:Verdana,sans-serif;font-size:12px;text-align:right">I have a webpage that has a start button and a stop button.&nbsp;</span></div><div><span style="color:rgb(68,68,68);font-family:Verdana,sans-serif;font-size:12px;text-align:right">These to buttons should start and stop the consuming messages.</span></div><div><span style="color:rgb(68,68,68);font-family:Verdana,sans-serif;font-size:12px;text-align:right"><br></span></div><div><span style="color:rgb(68,68,68);font-family:Verdana,sans-serif;font-size:12px;text-align:right">When the user presses start button the consuming starts... when the user presses the stop button the consuming stops</span></div><div><span style="color:rgb(68,68,68);font-family:Verdana,sans-serif;font-size:12px;text-align:right">BUT.. the user cannot start the consuming again.&nbsp;</span></div><div><span style="color:rgb(68,68,68);font-family:Verdana,sans-serif;font-size:12px;text-align:right">While debugging the code, I see the method call&nbsp;</span><font color="#444444" face="Verdana, sans-serif"><span style="font-size:12px">channel.basicCancel hangs... and the debugger stops...&nbsp;</span></font></div><div><font color="#444444" face="Verdana, sans-serif"><span style="font-size:12px">When I stop the JBoss server where the application is deployd I see this exception coming in the catch when doing&nbsp;channel.basicCancel.</span></font></div><div><span style="font-size:12px;color:rgb(68,68,68);font-family:Verdana,sans-serif;text-align:right">com.rabbitmq.client.<wbr>ShutdownSignalException: clean channel shutdown; reason: #method&lt;channel.close&gt;(reply-<wbr>code=200, reply-text=OK, class-id=0, method-id=0)</span><br></div><div><span style="text-align:right"><font color="#444444" face="Verdana, sans-serif"><span style="font-size:12px"><br></span></font></span></div><div style="text-align:start"><span style="text-align:right"><font color="#444444" face="Verdana, sans-serif"><span style="font-size:12px">And in the method&nbsp;</span></font></span><font color="#444444" face="Verdana, sans-serif"><span style="font-size:12px">handleDelivery I see&nbsp;ShutdownSignalException...</span></font></div><div style="text-align:start"><span style="font-size:12px;color:rgb(68,68,68);font-family:Verdana,sans-serif;text-align:right">com.rabbitmq.client.<wbr>AlreadyClosedException: clean connection shutdown; reason: Attempt to use closed channe</span><span style="text-align:right">l</span></div><div style="text-align:start"><span style="text-align:right"><br></span></div><div style="text-align:start"><span style="text-align:right">The call to&nbsp;</span>basicCancel only hangs when consuming is going on.. if I start the consuming, but no messages are on the queue, I can stop it.. and start it again.&nbsp;</div><div style="text-align:start"><br></div><div style="text-align:start"><div>@Override</div><div>protected final synchronized void service(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException {</div><div><span style="white-space:pre">        </span>String task = req.getParameter("task");</div><div>&nbsp; &nbsp; &nbsp; &nbsp; ...</div><div><span style="white-space:pre">        </span>if (StringUtils.isNotBlank(task) &amp;&amp; task.equals("stop")) {</div><div><span style="white-space:pre">                        </span>consuming = false;</div><div><span style="white-space:pre">                        </span>try {</div><div><span style="white-space:pre">                                </span>channel.basicCancel("<wbr>MonitorConsumer");</div><div><span style="white-space:pre">                        </span>} catch (Exception e) {</div><div><span style="white-space:pre">                                </span>e.printStackTrace();</div><div><span style="white-space:pre">                        </span>}</div><div><span style="white-space:pre">                </span>}</div><div><span style="white-space:pre">        </span>} else {</div><div><span style="white-space:pre">                </span>if (connection == null || channel == null) {</div><div><span style="white-space:pre">                        </span>createRabbitConnection();</div><div><span style="white-space:pre">                </span>}</div><div><span style="white-space:pre">                </span>if (!consuming) {</div><div><span style="white-space:pre">                        </span>channel.basicConsume(<wbr>Configuration.QUEUE_JSI_TO_<wbr>DASHBOARD, false, "MonitorConsumer", this);</div><div><span style="white-space:pre">                        </span>consuming = true;</div><div><span style="white-space:pre">                </span>}</div><div><span style="white-space:pre">        </span>}</div><div>}</div><div><br></div><div><div>public synchronized void handleDelivery(String consumerTag, Envelope envelope, BasicProperties properties, byte[] body) throws IOException {</div><div><span style="white-space:pre">        </span>...</div><div>&nbsp; &nbsp; &nbsp; &nbsp; try {</div><div><span style="white-space:pre">                </span>channel.basicAck(deliveryTag, false);</div><div><span style="white-space:pre">        </span>} catch (ShutdownSignalException e) {</div><div><span style="white-space:pre">                </span>e.printStackTrace();<br></div><div><span style="white-space:pre">        </span>}</div><div>}<br></div></div></div><div style="text-align:right"><br></div><div style="text-align:right"><br></div><div style="text-align:right"><br></div><div><span style="color:rgb(68,68,68);font-family:Verdana,sans-serif;font-size:12px;text-align:right"><br></span></div><div><span style="color:rgb(68,68,68);font-family:Verdana,sans-serif;font-size:12px;text-align:right"><br></span></div><div><span style="color:rgb(68,68,68);font-family:Verdana,sans-serif;font-size:12px;text-align:right"><br></span></div></blockquote></div>