[rabbitmq-discuss] channel.basicCancel hangs

Kristian Lind klindp at gmail.com
Wed May 22 00:02:59 BST 2013


RabbitMQ 3.0.2, Erlang R16A

I have a webpage that has a start button and a stop button. 
These to buttons should start and stop the consuming messages.

When the user presses start button the consuming starts... when the user 
presses the stop button the consuming stops
BUT.. the user cannot start the consuming again. 
While debugging the code, I see the method call channel.basicCancel 
hangs... and the debugger stops... 
When I stop the JBoss server where the application is deployd I see this 
exception coming in the catch when doing channel.basicCancel.
com.rabbitmq.client.ShutdownSignalException: clean channel shutdown; 
reason: #method<channel.close>(reply-code=200, reply-text=OK, class-id=0, 

And in the method handleDelivery I see ShutdownSignalException...
com.rabbitmq.client.AlreadyClosedException: clean connection shutdown; 
reason: Attempt to use closed channel

The call to 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. 

protected final synchronized void service(final HttpServletRequest req, 
final HttpServletResponse resp) throws ServletException, IOException {
String task = req.getParameter("task");
if (StringUtils.isNotBlank(task) && task.equals("stop")) {
consuming = false;
try {
} catch (Exception e) {
} else {
if (connection == null || channel == null) {
if (!consuming) {
channel.basicConsume(Configuration.QUEUE_JSI_TO_DASHBOARD, false, 
"MonitorConsumer", this);
consuming = true;

public synchronized void handleDelivery(String consumerTag, Envelope 
envelope, BasicProperties properties, byte[] body) throws IOException {
        try {
channel.basicAck(deliveryTag, false);
} catch (ShutdownSignalException e) {

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130521/a311f354/attachment.htm>

More information about the rabbitmq-discuss mailing list