9. Consumer-启动流程

本文详细解析了RocketMQ的推模式消费流程,包括消费者初始化、订阅信息设置、负载均衡策略、进度管理服务创建、消费进度加载及消费服务创建等关键步骤。

Rocketmq支持两种消费模式:拉模式和推模式,其中推模式也是基于拉模式实现的,这里主要看下基于推模式的消息消费流程。

常见的推模式的消费端代码如下:

public static void main(String[] args) throws MQClientException {
        String group = "test-group";
        String topic = "test-topic";

        DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(group);
        consumer.setNamesrvAddr("127.0.0.1:9876");
        consumer.subscribe(topic, "*");
        consumer.setInstanceName("c1");

        consumer.registerMessageListener(new MessageListenerConcurrently() {
            @Override
            public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs,
                                                            ConsumeConcurrentlyContext context) {
                System.out.printf("receive message: " + msgs);
                return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
            }
        });
        consumer.start();

        System.out.printf("Consumer Started.%n");
    }

定义一个DefaultMQPushConsumer,注册一个消息监听器,然后调用start方法。等有消息到达,会调用回调方法进行处理。

 

DefaultMQPushConsumer.start方法:

public void start() throws MQClientException {
        setConsumerGroup(NamespaceUtil.wrapNamespace(this.getNamespace(), this.consumerGroup));
        this.defaultMQPushConsumerImpl.start();
        if (null != traceDispatcher) {
            try {
                traceDispatcher.start(this.getNamesrvAddr(), this.getAccessChannel());
            } catch (MQClientException e) {
                log.warn("trace dispatcher start failed ", e);
            }
        }
    }

最终会调用消费端具体实现类的start方法,默认的实现类为:DefaultMQPushConsumerImpl

DefaultMQPushConsumerImpl.start方法:

public synchronized void start() throws MQClientException {
        switch (this.serviceState) {
            case CREATE_JUST:
                log.info("the consumer [{}] start beginning. messageModel={}, isUnitMode={}", this.defaultMQPushConsumer.getConsumerGroup(),
                    this.defaultMQPushConsumer.getMessageModel(), this.defaultMQPushConsumer.isUnitMode());
                this.serviceState = ServiceState.START_FAILED;

                this.checkConfig();

                //step0 设置订阅信息
                this.copySubscription();

                if (this.defaultMQPushConsumer.getMessageModel() == MessageModel.CLUSTERING) {
                    this.defaultMQPushConsumer.changeInstanceNameToPID();
                }
                //step1 创建消费实例
                this.mQClientFactory = MQClientManager.getInstance().getAndCreateMQClientInstance(this.defaultMQPushConsumer, this.rpcHook);

                //step2 初始化负载均衡服务                this.rebalanceImpl.setConsumerGroup(this.defaultMQPushConsumer.getConsumerGroup());
                this.rebalanceImpl.setMessageModel(this.defaultMQPushConsumer.getMessageModel());
                this.rebalanceImpl.setAllocateMessageQueueStrategy(this.defaultMQPushConsumer.getAllocateMessageQueueStrategy());
                this.rebalanceImpl.setmQClientFactory(this.mQClientFactory);

                this.pullAPIWrapper = new PullAPIWrapper(
                    mQClientFactory,
                    this.defaultMQPushConsumer.getConsumerGroup(), isUnitMode());
                this.pullAPIWrapper.registerFilterMessageHook(filterMessageHookList);

                //step3 创建进度管理服务
                if (this.defaultMQPushConsumer.getOffsetStore() != null) {
                    this.offsetStore = this.defaultMQPushConsumer.getOffsetStore();
                } else {
                    switch (this.defaultMQPushConsumer.getMessageModel()) {
                        case BROADCASTING:
                            this.offsetStore = new LocalFileOffsetStore(this.mQClientFactory, this.defaultMQPushConsumer.getConsumerGroup());
                            break;
                        case CLUSTERING:
                            this.offsetStore = new RemoteBrokerOffsetStore(this.mQClientFactory, this.defaultMQPushConsumer.getConsumerGroup());
                            break;
                        default:
                            break;
                    }
                    this.defaultMQPushConsumer.setOffsetStore(this.offsetStore);
                }
                //step4 加载消费进度
                this.offsetStore.load();

                //step5 启动消息消费服务
                if (this.getMessageListenerInner() instanceof MessageListenerOrderly) {
                    this.consumeOrderly = true;
                    this.consumeMessageService =
                        new ConsumeMessageOrderlyService(this, (MessageListenerOrderly) this.getMessageListenerInner());
                } else if (this.getMessageListenerInner() instanceof MessageListenerConcurrently) {
                    this.consumeOrderly = false;
                    this.consumeMessageService =
                        new ConsumeMessageConcurrentlyService(this, (MessageListenerConcurrently) this.getMessageListenerInner());
                }

                this.consumeMessageService.start();

                boolean registerOK = mQClientFactory.registerConsumer(this.defaultMQPushConsumer.getConsumerGroup(), this);
                if (!registerOK) {
                    this.serviceState = ServiceState.CREATE_JUST;
                    this.consumeMessageService.shutdown();
                    throw new MQClientException("The consumer group[" + this.defaultMQPushConsumer.getConsumerGroup()
                        + "] has been created before, specify another name please." + FAQUrl.suggestTodo(FAQUrl.GROUP_NAME_DUPLICATE_URL),
                        null);
                }

                //step6 启动消费实例
                mQClientFactory.start();
                log.info("the consumer [{}] start OK.", this.defaultMQPushConsumer.getConsumerGroup());
                this.serviceState = ServiceState.RUNNING;
                break;
            case RUNNING:
            case START_FAILED:
            case SHUTDOWN_ALREADY:
                throw new MQClientException("The PushConsumer service state not OK, maybe started once, "
                    + this.serviceState
                    + FAQUrl.suggestTodo(FAQUrl.CLIENT_SERVICE_NOT_OK),
                    null);
            default:
                break;
        }

        this.updateTopicSubscribeInfoWhenSubscriptionChanged();
        this.mQClientFactory.checkClientInBroker();
        this.mQClientFactory.sendHeartbeatToAllBrokerWithLock();
        this.mQClientFactory.rebalanceImmediately();
    }

step0,设置订阅信息,创建订阅信息,然后注册到负载均衡中,可以看出订阅信息是以消费组为单位的,并且会自动订阅topic的retry主题:%RETRY%+消费组名称

    private void copySubscription() throws MQClientException {
        try {
            Map<String, String> sub = this.defaultMQPushConsumer.getSubscription();
            if (sub != null) {
                for (final Map.Entry<String, String> entry : sub.entrySet()) {
                    final String topic = entry.getKey();
                    final String subString = entry.getValue();
                    SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(),
                        topic, subString);
                    this.rebalanceImpl.getSubscriptionInner().put(topic, subscriptionData);
                }
            }

            if (null == this.messageListenerInner) {
                this.messageListenerInner = this.defaultMQPushConsumer.getMessageListener();
            }

            switch (this.defaultMQPushConsumer.getMessageModel()) {
                case BROADCASTING:
                    break;
                case CLUSTERING:
                    final String retryTopic = MixAll.getRetryTopic(this.defaultMQPushConsumer.getConsumerGroup());
                    SubscriptionData subscriptionData = FilterAPI.buildSubscriptionData(this.defaultMQPushConsumer.getConsumerGroup(),
                        retryTopic, SubscriptionData.SUB_ALL);
                    this.rebalanceImpl.getSubscriptionInner().put(retryTopic, subscriptionData);
                    break;
                default:
                    break;
            }
        } catch (Exception e) {
            throw new MQClientException("subscription exception", e);
        }
    }

 

step1,创建消费实例

MQClientManager.getAndCreateMQClientInstance方法:

    public MQClientInstance getAndCreateMQClientInstance(final ClientConfig clientConfig, RPCHook rpcHook) {
        String clientId = clientConfig.buildMQClientId();
        MQClientInstance instance = this.factoryTable.get(clientId);
        if (null == instance) {
            instance =
                new MQClientInstance(clientConfig.cloneClientConfig(),
                    this.factoryIndexGenerator.getAndIncrement(), clientId, rpcHook);
            MQClientInstance prev = this.factoryTable.putIfAbsent(clientId, instance);
            if (prev != null) {
                instance = prev;
                log.warn("Returned Previous MQClientInstance for clientId:[{}]", clientId);
            } else {
                log.info("Created new MQClientInstance for clientId:[{}]", clientId);
            }
        }

        return instance;
    }

其中buildMQClientId生成实例ID:客户端ip+实例名称,如果实例名称不设置,则默认被设置为端口号。

所以,如果一个JVM中要启动多个实例,必须要设置instancename,否则获取到的是同一个instance,无法重复启动。

 

step2,设置初始化负载均衡服务

其中默认的负载均衡策略为平均分配:AllocateMessageQueueAveragely

 

step3,创建进度管理服务

根据消费类型是集群模式还是广播模式,创建不同的进度管理服务。

其中广播模式进度是存在客户端中的,所以创建的是LocalFileOffsetStore服务。

而集群模式消费进度是存储在broker中,所以创建的是RemoteBrokerOffsetStore,需要从broker中拉取消费进度,并将消费进度同步到broker中的。

 

step4,加载消费进度

如果是LocalFileOffsetStore服务,从文件中加载消费进度。

如果是RemoteBrokerOffsetStore,从broker拉取进度。

 

step5, 创建消费服务

Rocketmq支持顺序消费和并发消费,根据消费类型创建不同的消费服务,两种消费的差异在与:

如果是顺序消费,则只有单线程一个一个消费;

如果是并发消费,则不考虑消息的顺序问题,多个线程进行消费。

 

step6,启动消费实例

MQClientInstance.start方法:

public void start() throws MQClientException {

        synchronized (this) {
            switch (this.serviceState) {
                case CREATE_JUST:
                    this.serviceState = ServiceState.START_FAILED;
                    // If not specified,looking address from name server
                    if (null == this.clientConfig.getNamesrvAddr()) {
                        this.mQClientAPIImpl.fetchNameServerAddr();
                    }
                    // Start request-response channel
                    this.mQClientAPIImpl.start();
                    // Start various schedule tasks
                    this.startScheduledTask();
                    // Start pull service
                    this.pullMessageService.start();
                    // Start rebalance service
                    this.rebalanceService.start();
                    // Start push service
                    this.defaultMQProducer.getDefaultMQProducerImpl().start(false);
                    log.info("the client factory [{}] start OK", this.clientId);
                    this.serviceState = ServiceState.RUNNING;
                    break;
                case RUNNING:
                    break;
                case SHUTDOWN_ALREADY:
                    break;
                case START_FAILED:
                    throw new MQClientException("The Factory object[" + this.getClientId() + "] has been created before, and failed.", null);
                default:
                    break;
            }
        }
    }

start方法中,主要就是启动各种服务,消息拉取服务,负载均衡服务等。

 

 

 

 

 

 

 

 

 

2025-11-05 15:19:23.442 [main] INFO o.w.a.web.api.WebApiApplication - Starting WebApiApplication using Java 17.0.16 with PID 24352 (D:\world_aquatics_0922\world-aquatics-api\world-aquatics-web-api\target\classes started by LZY in D:\world_aquatics_0922) 2025-11-05 15:19:23.444 [main] INFO o.w.a.web.api.WebApiApplication - No active profile set, falling back to 1 default profile: "default" 2025-11-05 15:19:25.147 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Multiple Spring Data modules found, entering strict repository configuration mode 2025-11-05 15:19:25.149 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Bootstrapping Spring Data Elasticsearch repositories in DEFAULT mode. 2025-11-05 15:19:25.166 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 13 ms. Found 0 Elasticsearch repository interfaces. 2025-11-05 15:19:25.171 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Multiple Spring Data modules found, entering strict repository configuration mode 2025-11-05 15:19:25.171 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Bootstrapping Spring Data Reactive Elasticsearch repositories in DEFAULT mode. 2025-11-05 15:19:25.173 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 1 ms. Found 0 Reactive Elasticsearch repository interfaces. 2025-11-05 15:19:25.183 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Multiple Spring Data modules found, entering strict repository configuration mode 2025-11-05 15:19:25.184 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Bootstrapping Spring Data Redis repositories in DEFAULT mode. 2025-11-05 15:19:25.192 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 1 ms. Found 0 Redis repository interfaces. 2025-11-05 15:19:25.879 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat initialized with port 8081 (http) 2025-11-05 15:19:25.891 [main] INFO o.a.catalina.core.StandardService - Starting service [Tomcat] 2025-11-05 15:19:25.891 [main] INFO o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/10.1.16] 2025-11-05 15:19:25.960 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext 2025-11-05 15:19:25.960 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 2480 ms 2025-11-05 15:19:25.981 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key &#39;jwt.secret&#39; in PropertySource &#39;environmentProperties&#39; with value of type String 2025-11-05 15:19:25.982 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key &#39;jwt.expire&#39; in PropertySource &#39;environmentProperties&#39; with value of type String Logging initialized using &#39;class org.apache.ibatis.logging.stdout.StdOutImpl&#39; adapter. Can not find table primary key in Class: "org.world.aquatics.common.domain.SysRoleMenuTbl". 2025-11-05 15:19:26.770 [main] WARN c.b.m.c.injector.DefaultSqlInjector - class org.world.aquatics.common.domain.SysRoleMenuTbl ,Not found @TableId annotation, Cannot use Mybatis-Plus &#39;xxById&#39; Method. Can not find table primary key in Class: "org.world.aquatics.common.domain.SysUserRoleTbl". 2025-11-05 15:19:26.800 [main] WARN c.b.m.c.injector.DefaultSqlInjector - class org.world.aquatics.common.domain.SysUserRoleTbl ,Not found @TableId annotation, Cannot use Mybatis-Plus &#39;xxById&#39; Method. Initialization Sequence datacenterId:11 workerId:14 _ _ |_ _ _|_. ___ _ | _ | | |\/|_)(_| | |_\ |_)||_|_\ / | 3.5.5 2025-11-05 15:19:27.193 [main] INFO o.w.a.s.config.ElasticsearchConfig - Elasticsearch 配置加载: host={172.18.56.53}, port={9201} 2025-11-05 15:19:27.520 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key &#39;spring.kafka.bootstrap-servers&#39; in PropertySource &#39;environmentProperties&#39; with value of type String 2025-11-05 15:19:27.521 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key &#39;spring.kafka.consumer.group-id&#39; in PropertySource &#39;environmentProperties&#39; with value of type String 2025-11-05 15:19:27.786 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key &#39;springdoc.api-docs.path&#39; in PropertySource &#39;environmentProperties&#39; with value of type String 2025-11-05 15:19:27.786 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key &#39;springdoc.api-docs.path&#39; in PropertySource &#39;environmentProperties&#39; with value of type String 2025-11-05 15:19:27.789 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key &#39;springdoc.api-docs.path&#39; in PropertySource &#39;environmentProperties&#39; with value of type String 2025-11-05 15:19:27.790 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key &#39;springdoc.api-docs.path&#39; in PropertySource &#39;environmentProperties&#39; with value of type String 2025-11-05 15:19:27.791 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key &#39;springdoc.swagger-ui.path&#39; in PropertySource &#39;environmentProperties&#39; with value of type String 2025-11-05 15:19:27.791 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key &#39;springdoc.swagger-ui.path&#39; in PropertySource &#39;environmentProperties&#39; with value of type String 2025-11-05 15:19:27.791 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key &#39;springdoc.api-docs.path&#39; in PropertySource &#39;environmentProperties&#39; with value of type String 2025-11-05 15:19:27.902 [main] INFO o.s.s.web.DefaultSecurityFilterChain - Will secure any request with [org.springframework.security.web.session.DisableEncodeUrlFilter@476a2819, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@279ab15e, org.springframework.security.web.context.SecurityContextHolderFilter@3bbc47c9, org.springframework.security.web.header.HeaderWriterFilter@62a81453, org.springframework.web.filter.CorsFilter@571c2ed8, org.springframework.security.web.authentication.logout.LogoutFilter@188ae8d2, org.world.aquatics.web.api.sso.JwtRequestFilter@2055833f, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@144dc2f7, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@403cff1c, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@5810772a, org.springframework.security.web.session.SessionManagementFilter@690677de, org.springframework.security.web.access.ExceptionTranslationFilter@102aa5fc, org.springframework.security.web.access.intercept.AuthorizationFilter@eddc9bb] 2025-11-05 15:19:28.324 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port 8081 (http) with context path &#39;&#39; 2025-11-05 15:19:28.363 [main] INFO o.a.k.c.consumer.ConsumerConfig - ConsumerConfig values: allow.auto.create.topics = true auto.commit.interval.ms = 5000 auto.include.jmx.reporter = true auto.offset.reset = earliest bootstrap.servers = [172.18.56.53:9092] check.crcs = true client.dns.lookup = use_all_dns_ips client.id = consumer-world-aquatics-group-1 client.rack = connections.max.idle.ms = 540000 default.api.timeout.ms = 60000 enable.auto.commit = false exclude.internal.topics = true fetch.max.bytes = 52428800 fetch.max.wait.ms = 500 fetch.min.bytes = 1 group.id = world-aquatics-group group.instance.id = null heartbeat.interval.ms = 3000 interceptor.classes = [] internal.leave.group.on.close = true internal.throw.on.fetch.stable.offset.unsupported = false isolation.level = read_uncommitted key.deserializer = class org.apache.kafka.common.serialization.StringDeserializer max.partition.fetch.bytes = 1048576 max.poll.interval.ms = 300000 max.poll.records = 500 metadata.max.age.ms = 300000 metric.reporters = [] metrics.num.samples = 2 metrics.recording.level = INFO metrics.sample.window.ms = 30000 partition.assignment.strategy = [class org.apache.kafka.clients.consumer.RangeAssignor, class org.apache.kafka.clients.consumer.CooperativeStickyAssignor] receive.buffer.bytes = 65536 reconnect.backoff.max.ms = 1000 reconnect.backoff.ms = 50 request.timeout.ms = 30000 retry.backoff.ms = 100 sasl.client.callback.handler.class = null sasl.jaas.config = null sasl.kerberos.kinit.cmd = /usr/bin/kinit sasl.kerberos.min.time.before.relogin = 60000 sasl.kerberos.service.name = null sasl.kerberos.ticket.renew.jitter = 0.05 sasl.kerberos.ticket.renew.window.factor = 0.8 sasl.login.callback.handler.class = null sasl.login.class = null sasl.login.connect.timeout.ms = null sasl.login.read.timeout.ms = null sasl.login.refresh.buffer.seconds = 300 sasl.login.refresh.min.period.seconds = 60 sasl.login.refresh.window.factor = 0.8 sasl.login.refresh.window.jitter = 0.05 sasl.login.retry.backoff.max.ms = 10000 sasl.login.retry.backoff.ms = 100 sasl.mechanism = GSSAPI sasl.oauthbearer.clock.skew.seconds = 30 sasl.oauthbearer.expected.audience = null sasl.oauthbearer.expected.issuer = null sasl.oauthbearer.jwks.endpoint.refresh.ms = 3600000 sasl.oauthbearer.jwks.endpoint.retry.backoff.max.ms = 10000 sasl.oauthbearer.jwks.endpoint.retry.backoff.ms = 100 sasl.oauthbearer.jwks.endpoint.url = null sasl.oauthbearer.scope.claim.name = scope sasl.oauthbearer.sub.claim.name = sub sasl.oauthbearer.token.endpoint.url = null security.protocol = PLAINTEXT security.providers = null send.buffer.bytes = 131072 session.timeout.ms = 45000 socket.connection.setup.timeout.max.ms = 30000 socket.connection.setup.timeout.ms = 10000 ssl.cipher.suites = null ssl.enabled.protocols = [TLSv1.2, TLSv1.3] ssl.endpoint.identification.algorithm = https ssl.engine.factory.class = null ssl.key.password = null ssl.keymanager.algorithm = SunX509 ssl.keystore.certificate.chain = null ssl.keystore.key = null ssl.keystore.location = null ssl.keystore.password = null ssl.keystore.type = JKS ssl.protocol = TLSv1.3 ssl.provider = null ssl.secure.random.implementation = null ssl.trustmanager.algorithm = PKIX ssl.truststore.certificates = null ssl.truststore.location = null ssl.truststore.password = null ssl.truststore.type = JKS value.deserializer = class org.apache.kafka.common.serialization.StringDeserializer 2025-11-05 15:19:28.445 [main] INFO o.a.kafka.common.utils.AppInfoParser - Kafka version: 3.6.0 2025-11-05 15:19:28.446 [main] INFO o.a.kafka.common.utils.AppInfoParser - Kafka commitId: 60e845626d8a465a 2025-11-05 15:19:28.446 [main] INFO o.a.kafka.common.utils.AppInfoParser - Kafka startTimeMs: 1762327168444 2025-11-05 15:19:28.448 [main] INFO o.s.k.c.DefaultKafkaConsumerFactory$ExtendedKafkaConsumer - [Consumer clientId=consumer-world-aquatics-group-1, groupId=world-aquatics-group] Subscribed to topic(s): world-aquatics-topic 2025-11-05 15:19:28.462 [main] INFO o.w.a.web.api.WebApiApplication - Started WebApiApplication in 5.359 seconds (process running for 7.57) === Config File Loading Information === Active profiles: [] Default profiles: [default] 2025-11-05 15:19:28.464 [main] INFO o.w.a.web.api.WebApiApplication - WebApiApplication启动成功! 2025-11-05 15:19:28.857 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] INFO org.apache.kafka.clients.Metadata - [Consumer clientId=consumer-world-aquatics-group-1, groupId=world-aquatics-group] Cluster ID: seNzt9cQRVW5qmRcTDdWIw 2025-11-05 15:19:28.858 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] INFO o.a.k.c.c.i.ConsumerCoordinator - [Consumer clientId=consumer-world-aquatics-group-1, groupId=world-aquatics-group] Discovered group coordinator 172.18.56.53:9092 (id: 2147483646 rack: null) 2025-11-05 15:19:28.859 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] INFO o.a.k.c.c.i.ConsumerCoordinator - [Consumer clientId=consumer-world-aquatics-group-1, groupId=world-aquatics-group] (Re-)joining group 2025-11-05 15:19:28.872 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] INFO o.a.k.c.c.i.ConsumerCoordinator - [Consumer clientId=consumer-world-aquatics-group-1, groupId=world-aquatics-group] Request joining group due to: need to re-join with the given member-id: consumer-world-aquatics-group-1-3cdba838-80cb-4630-9f17-37c5002ee331 2025-11-05 15:19:28.873 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] INFO o.a.k.c.c.i.ConsumerCoordinator - [Consumer clientId=consumer-world-aquatics-group-1, groupId=world-aquatics-group] Request joining group due to: rebalance failed due to &#39;The group member needs to have a valid member id before actually entering a consumer group.&#39; (MemberIdRequiredException) 2025-11-05 15:19:28.873 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] INFO o.a.k.c.c.i.ConsumerCoordinator - [Consumer clientId=consumer-world-aquatics-group-1, groupId=world-aquatics-group] (Re-)joining group 2025-11-05 15:19:31.882 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] INFO o.a.k.c.c.i.ConsumerCoordinator - [Consumer clientId=consumer-world-aquatics-group-1, groupId=world-aquatics-group] Successfully joined group with generation Generation{generationId=1, memberId=&#39;consumer-world-aquatics-group-1-3cdba838-80cb-4630-9f17-37c5002ee331&#39;, protocol=&#39;range&#39;} 2025-11-05 15:19:31.887 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] INFO o.a.k.c.c.i.ConsumerCoordinator - [Consumer clientId=consumer-world-aquatics-group-1, groupId=world-aquatics-group] Finished assignment for group at generation 1: {consumer-world-aquatics-group-1-3cdba838-80cb-4630-9f17-37c5002ee331=Assignment(partitions=[world-aquatics-topic-0])} 2025-11-05 15:19:31.901 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] INFO o.a.k.c.c.i.ConsumerCoordinator - [Consumer clientId=consumer-world-aquatics-group-1, groupId=world-aquatics-group] Successfully synced group in generation Generation{generationId=1, memberId=&#39;consumer-world-aquatics-group-1-3cdba838-80cb-4630-9f17-37c5002ee331&#39;, protocol=&#39;range&#39;} 2025-11-05 15:19:31.901 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] INFO o.a.k.c.c.i.ConsumerCoordinator - [Consumer clientId=consumer-world-aquatics-group-1, groupId=world-aquatics-group] Notifying assignor about the new Assignment(partitions=[world-aquatics-topic-0]) 2025-11-05 15:19:31.902 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] INFO o.a.k.c.c.i.ConsumerCoordinator - [Consumer clientId=consumer-world-aquatics-group-1, groupId=world-aquatics-group] Adding newly assigned partitions: world-aquatics-topic-0 2025-11-05 15:19:31.910 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] INFO o.a.k.c.c.i.ConsumerCoordinator - [Consumer clientId=consumer-world-aquatics-group-1, groupId=world-aquatics-group] Found no committed offset for partition world-aquatics-topic-0 2025-11-05 15:19:31.918 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] INFO o.a.k.c.c.i.SubscriptionState - [Consumer clientId=consumer-world-aquatics-group-1, groupId=world-aquatics-group] Resetting offset for partition world-aquatics-topic-0 to position FetchPosition{offset=0, offsetEpoch=Optional.empty, currentLeader=LeaderAndEpoch{leader=Optional[172.18.56.53:9092 (id: 1 rack: null)], epoch=0}}. 2025-11-05 15:19:31.919 [org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1] INFO o.s.k.l.KafkaMessageListenerContainer - world-aquatics-group: partitions assigned: [world-aquatics-topic-0] 这一段日志输出表明了什么问题?需要怎么去解决这个问题?
最新发布
11-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值