[ISSUE #8725] clean DefaultMQPushConsumer after start fail (#8726)

* [ISSUE #8725]clean DefaultMQPushConsumer after start fail

* clean DefaultLitePullConsumerImpl after start fail
This commit is contained in:
yuz10
2024-10-30 20:08:28 +08:00
committed by GitHub
parent fe8077250b
commit 5600684eb4
2 changed files with 16 additions and 5 deletions
@@ -307,7 +307,12 @@ public class DefaultLitePullConsumerImpl implements MQConsumerInner {
log.info("the consumer [{}] start OK", this.defaultLitePullConsumer.getConsumerGroup());
operateAfterRunning();
try {
operateAfterRunning();
} catch (Exception e) {
shutdown();
throw e;
}
break;
case RUNNING:
@@ -1006,10 +1006,16 @@ public class DefaultMQPushConsumerImpl implements MQConsumerInner {
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;
}
}