Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/main/java/com/rabbitmq/perf/Consumer.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ private void startBasicGetConsumer() {
try {
GetResponse response = ch.basicGet(queue, autoAck);
if (response != null) {
delegate.handleMessage(
delegate.maybeHandleMessage(
response.getEnvelope(), response.getProps(), response.getBody(), ch);
}
} catch (IOException e) {
Expand Down Expand Up @@ -280,7 +280,13 @@ private ConsumerImpl(Channel channel) {
public void handleDelivery(
String consumerTag, Envelope envelope, BasicProperties properties, byte[] body)
throws IOException {
this.handleMessage(envelope, properties, body, channel);
this.maybeHandleMessage(envelope, properties, body, channel);
}

private void maybeHandleMessage(Envelope envelope, BasicProperties properties, byte[] body, Channel ch) throws IOException {
if (ch.isOpen()) {
handleMessage(envelope, properties, body, ch);
}
}

void handleMessage(Envelope envelope, BasicProperties properties, byte[] body, Channel ch)
Expand Down
Loading