[rabbitmq-discuss] Cathing broker shut down in a consumer

Tim Watson tim at rabbitmq.com
Fri Dec 21 12:06:21 GMT 2012


On 20 Dec 2012, at 18:55, CJ wrote:
> I do not seem to be able to catch the problem of the broker coming down in 
> the consumer.  I use the following code on the nextDelivery
>  
>       catch (ShutdownSignalException ex) {
>          System.out.println("--- Broker Shut Down ---");
>       }
>       catch (Exception ex) {
>          System.out.println("--- Broker Shut Down ---");
>       }
>  
> But I get the following error:
>  
> Exception in thread "main" com.rabbitmq.client.ShutdownSignalException: connecti
> on error; reason: {#method<connection.close>(reply-code=320, reply-text=CONNECTI
> ON_FORCED - broker forced connection closure with reason 'shutdown', class-id=0,
>  method-id=0), null, ""}
>         at com.rabbitmq.client.QueueingConsumer.handle(QueueingConsumer.java:198
> )
>         at com.rabbitmq.client.QueueingConsumer.nextDelivery(QueueingConsumer.ja
> va:227)
>         at Recv.main(Recv.java:50)
>  
> Does Rabbit support catching broken connections in the consumer ?
> 

Are you sure you're looking at the exception that you think!? More to the point, are you sure it's being thrown in the thread you think you're catching it in?



More information about the rabbitmq-discuss mailing list