Skip to content

Commit

Permalink
[ISSUE #8725] clean DefaultMQPushConsumer after start fail (#8726)
Browse files Browse the repository at this point in the history
* [ISSUE #8725]clean DefaultMQPushConsumer after start fail

* clean DefaultLitePullConsumerImpl after start fail
  • Loading branch information
yuz10 authored Oct 30, 2024
1 parent fe80772 commit 5600684
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,12 @@ public synchronized void start() throws MQClientException {

log.info("the consumer [{}] start OK", this.defaultLitePullConsumer.getConsumerGroup());

operateAfterRunning();
try {
operateAfterRunning();
} catch (Exception e) {
shutdown();
throw e;
}

break;
case RUNNING:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1006,10 +1006,16 @@ public synchronized void start() throws MQClientException {
break;
}

this.updateTopicSubscribeInfoWhenSubscriptionChanged();
this.mQClientFactory.checkClientInBroker();
if (this.mQClientFactory.sendHeartbeatToAllBrokerWithLock()) {
this.mQClientFactory.rebalanceImmediately();
try {
this.updateTopicSubscribeInfoWhenSubscriptionChanged();
this.mQClientFactory.checkClientInBroker();
if (this.mQClientFactory.sendHeartbeatToAllBrokerWithLock()) {
this.mQClientFactory.rebalanceImmediately();
}
} catch (Exception e) {
log.warn("Start the consumer {} fail.", this.defaultMQPushConsumer.getConsumerGroup(), e);
shutdown();
throw e;
}
}

Expand Down

0 comments on commit 5600684

Please sign in to comment.