Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 9 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,14 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,11 @@ public void consumerCount(int consumersCount, int channelsCount) throws Exceptio
Channel channel =
proxy(
Channel.class,
callback(
"isOpen",
(proxy, method, args) -> {
return true;
}),
callback(
"basicConsume",
(proxy, method, args) -> {
Expand Down Expand Up @@ -458,6 +463,11 @@ void shouldAckOneLastTimeWhenQueueIsEmpty() throws Exception {
Channel channel =
proxy(
Channel.class,
callback(
"isOpen",
(proxy, method, args) -> {
return true;
}),
callback(
"basicConsume",
(proxy, method, args) -> {
Expand Down Expand Up @@ -924,6 +934,11 @@ public void pollingWithBasicGet(int consumersCount, int channelsCount) throws Ex
Channel channel =
proxy(
Channel.class,
callback(
"isOpen",
(proxy, method, args) -> {
return true;
}),
callback(
"basicGet",
(proxy, method, args) -> {
Expand Down Expand Up @@ -1014,6 +1029,11 @@ public void ackNack(String nackParameter) throws Exception {
Channel channel =
proxy(
Channel.class,
callback(
"isOpen",
(proxy, method, args) -> {
return true;
}),
callback(
"basicConsume",
(proxy, method, args) -> {
Expand Down