Skip to content

Commit

Permalink
AMQP-801: Move ConsumeOkEvent to handleConsumeOk
Browse files Browse the repository at this point in the history
JIRA: https://jira.spring.io/browse/AMQP-801

The proper place to emit the `ConsumeOkEvent` is really a
`handleConsumeOk()` callback when broker answers us that consumer has
been subscribed to the queue

**Cherry-pick to 1.7.x**
  • Loading branch information
artembilan authored and garyrussell committed Mar 7, 2018
1 parent e2fb3f8 commit 8fc94eb
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -684,9 +684,6 @@ private void consumeFromQueue(String queue) throws IOException {
else {
logger.error("Null consumer tag received for queue " + queue);
}
if (this.applicationEventPublisher != null) {
this.applicationEventPublisher.publishEvent(new ConsumeOkEvent(this, queue, consumerTag));
}
}

private void attemptPassiveDeclarations() {
Expand Down Expand Up @@ -885,7 +882,12 @@ private InternalConsumer(Channel channel) {
public void handleConsumeOk(String consumerTag) {
super.handleConsumeOk(consumerTag);
if (logger.isDebugEnabled()) {
logger.debug("ConsumeOK : " + BlockingQueueConsumer.this);
logger.debug("ConsumeOK: " + BlockingQueueConsumer.this);
}
if (BlockingQueueConsumer.this.applicationEventPublisher != null) {
String queueName = BlockingQueueConsumer.this.consumerTags.get(consumerTag);
BlockingQueueConsumer.this.applicationEventPublisher
.publishEvent(new ConsumeOkEvent(this, queueName, consumerTag));
}
}

Expand Down

0 comments on commit 8fc94eb

Please sign in to comment.