Skip to content

Commit 76d85cc

Browse files
Demonstrate that DefaultExceptionHnalder#handleConsumerException closes the channel
1 parent a8d1ae0 commit 76d85cc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/src/com/rabbitmq/client/test/functional/ExceptionHandling.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public void testHandleConsumerException() throws IOException, InterruptedExcepti
2828
final DefaultExceptionHandler eh = new DefaultExceptionHandler() {
2929
@Override
3030
public void handleConsumerException(Channel channel, Throwable exception, Consumer consumer, String consumerTag, String methodName) {
31+
super.handleConsumerException(channel, exception, consumer, consumerTag, methodName);
3132
latch.countDown();
3233
}
3334
};
@@ -41,11 +42,12 @@ public void handleConsumerException(Channel channel, Throwable exception, Consum
4142
@Override
4243
public void handleDelivery(String consumerTag, Envelope envelope,
4344
AMQP.BasicProperties properties, byte[] body) throws IOException {
44-
throw new RuntimeException("oops");
45+
throw new RuntimeException("exception expected here, don't freak out");
4546
}
4647
});
4748
ch.basicPublish("", q, null, "".getBytes());
4849
wait(latch);
50+
assertFalse(ch.isOpen());
4951
}
5052

5153
public void testNullExceptionHandler() {

0 commit comments

Comments
 (0)