Skip to content

SetPollTimeOut and HeartBeat  #248

@dilipthelip

Description

@dilipthelip

Hi ,

I have a two clarifications on the below piece of code.

Clarification 1:

We have the polltimeout set as follows.

@Bean
    KafkaListenerContainerFactory<ConcurrentMessageListenerContainer<String, String>> kafkaListenerContainerFactory() {
        ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<>();
        factory.setConsumerFactory(consumerFactory());
        factory.setConcurrency(Integer.valueOf(env.getProperty(Constants.KAFKA_CONCURRENCY)));
        factory.getContainerProperties().setPollTimeout(3000);
        factory.getContainerProperties().setAckMode(AbstractMessageListenerContainer.AckMode.MANUAL);
        factory.setRetryTemplate(new RetryTemplate() {{
            setRetryPolicy(new AlwaysRetryPolicy());
            setBackOffPolicy(new FixedBackOffPolicy() {{
                setBackOffPeriod(1000); // back off for 1 second between retries
            }});
        }});

Is this above setPollTimeout similar to poll method in the Kafka consumer class ?

  KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props);
      
  ConsumerRecords<String, String> records = consumer.poll(100);

What exactly happens when the consumer comes up ?

Does the consumer polls the topic and waits for 3 seconds and pull the records and return ?

or

Does it poll the topic every 3 seconds?

factory.getContainerProperties().setPollTimeout(3000);

Clarification 2:

We are leveraging consumer group strategy in our consumers.When will the heartbeat be sent to group coordinator ?

Is the Heartbeat sent during poll method ? Is the Heart beat sent while commiting the offset ?

Any help is much appreciated ?

Thanks !

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions