-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
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 !