kafka-consumer-api

KafkaConsumer.commitAsync() behavior with a lower offset than previous

痞子三分冷 提交于 2020-12-06 12:56:36
问题 How will kafka deal with a call to KafkaConsumer.commitAsync(Map<TopicPartition, OffsetAndMetadata> offsets, OffsetCommitCallback callback) when offset value for a topic is given as a lesser value than a previous invocation? 回答1: It will simply set the offset of the partition to the value you specified,so next time you will consume you message from commitedOffset+1. The javadoc of commitAsync() says: The committed offset should be the next message your application will consume,i.e.

KafkaConsumer.commitAsync() behavior with a lower offset than previous

匆匆过客 提交于 2020-12-06 12:55:48
问题 How will kafka deal with a call to KafkaConsumer.commitAsync(Map<TopicPartition, OffsetAndMetadata> offsets, OffsetCommitCallback callback) when offset value for a topic is given as a lesser value than a previous invocation? 回答1: It will simply set the offset of the partition to the value you specified,so next time you will consume you message from commitedOffset+1. The javadoc of commitAsync() says: The committed offset should be the next message your application will consume,i.e.

KafkaConsumer.commitAsync() behavior with a lower offset than previous

ε祈祈猫儿з 提交于 2020-12-06 12:55:31
问题 How will kafka deal with a call to KafkaConsumer.commitAsync(Map<TopicPartition, OffsetAndMetadata> offsets, OffsetCommitCallback callback) when offset value for a topic is given as a lesser value than a previous invocation? 回答1: It will simply set the offset of the partition to the value you specified,so next time you will consume you message from commitedOffset+1. The javadoc of commitAsync() says: The committed offset should be the next message your application will consume,i.e.

How do I configure Spring Kafka Listener for a specfic topic using the factory?

与世无争的帅哥 提交于 2020-12-02 00:20:37
问题 I want to be able to read in topics through the properties without specifying anything on the Kafka listener annotation. Not using Spring Boot. I tried having the topics read straight from the properties object via a "topics" key. That gives an error: IllegalStateException:topics, topicPattern, or topicPartitions must be provided. // some class @KafkaListener public void listener(List<String> messages) { System.out.print(messages); } //some other class @Bean public ConsumerFactory<String,

How do I configure Spring Kafka Listener for a specfic topic using the factory?

亡梦爱人 提交于 2020-12-02 00:16:50
问题 I want to be able to read in topics through the properties without specifying anything on the Kafka listener annotation. Not using Spring Boot. I tried having the topics read straight from the properties object via a "topics" key. That gives an error: IllegalStateException:topics, topicPattern, or topicPartitions must be provided. // some class @KafkaListener public void listener(List<String> messages) { System.out.print(messages); } //some other class @Bean public ConsumerFactory<String,

How do I configure Spring Kafka Listener for a specfic topic using the factory?

假如想象 提交于 2020-12-02 00:16:19
问题 I want to be able to read in topics through the properties without specifying anything on the Kafka listener annotation. Not using Spring Boot. I tried having the topics read straight from the properties object via a "topics" key. That gives an error: IllegalStateException:topics, topicPattern, or topicPartitions must be provided. // some class @KafkaListener public void listener(List<String> messages) { System.out.print(messages); } //some other class @Bean public ConsumerFactory<String,

How do I configure Spring Kafka Listener for a specfic topic using the factory?

时间秒杀一切 提交于 2020-12-02 00:06:21
问题 I want to be able to read in topics through the properties without specifying anything on the Kafka listener annotation. Not using Spring Boot. I tried having the topics read straight from the properties object via a "topics" key. That gives an error: IllegalStateException:topics, topicPattern, or topicPartitions must be provided. // some class @KafkaListener public void listener(List<String> messages) { System.out.print(messages); } //some other class @Bean public ConsumerFactory<String,

Kafka: Single consumer group in multiple instances

醉酒当歌 提交于 2020-11-30 12:44:20
问题 I am working on implementing a Kafka based solution to our application. As per the Kafka documentation, what i understand is one consumer in a consumer group (which is a thread) is internally mapped to one partition in the subscribed topic. Let's say i have a topic with 40 partitions and i have a high level consumer running in 4 instances. I do not want one instance to consume the same messages consumed by another instance. But if one instance goes down, the other three instances should be

Kafka Msg VS REST Calls

血红的双手。 提交于 2020-11-30 06:21:16
问题 Nowadays in microservice world, i’m seeing alot of design in my workplace that uses kafka messaging when you can achieve similar results using rest api calls between microservices. Technically you can stop using rest api calls altogether and instead use kafka messaging. I really want to know the best practice, pros and cons, when to use api calls between microsevices, when to use kafka messaging. Lets put a real life example: I have an inventory service and a vendor service. Everyday vendor