Closed mocenas closed 4 years ago
@mocenas I've expanded the README https://github.com/snowdrop/vertx-spring-boot/commit/5d84233731c1c010d807585c562f8b97ebe272c3. Please take a look and let me know if it now answers your questions.
@gytis Thanks, it's much better now. But still some things are missing. The more important ones:
consumer.flux.subscribe(record -> {})
What data type is the record? How to get the message from it?Less important ones:
consumer.seek(partition, offset)
is the offset absolute or relative? Can I somehow get my current offset?This a generic Kafka theory not dependant on a client API that is being used. You setup your application to be producer-consumer or publisher-subscriber using the consumer groups. With this this particular client library you can do that in your application configuration (this will set the same group id for all your consumers) or when creating a consumer.
A consumer interface has genetic types (https://github.com/snowdrop/vertx-spring-boot/blob/master/vertx-spring-boot-starter-kafka/src/main/java/dev/snowdrop/vertx/kafka/KafkaConsumer.java). You have to specify what type of records will be consumed when creating a consumer.
There is assignments method for that.
I'm not sure what is a relative offset. Every consumer tracks an offset of where it is in a partition. So if you seek to an offset 0
you'll end up at the start of the partition.
Yes this is generic Kafka theory. But I take this Kafka starter as a blackbox (as probably customers will). You say I can setup producer-consumer or publisher-subscriber via application configuration - I ask how? what properties to set? Is Kafka starter a wrapper around some generic Kafka client, whose properties can I use? I understand we can't cover everything in the doc, but this is really basic use case, which I really should be able to handle, just by reading the doc.
Ok, can you at least link KafkaConsumerRecord in the doc and explain it a bit? Having current
consumer.flux().subscribe(this::doSomething);
is really not helpful enough.
OK
By relative I meant, relative to my current offset - e.g. I'm on offset 10, .seek(-3), I'm on offset 7. The way it is in the doc is pretty much OK, I was rather curious.
Added a background section with links to the Kafka and upstream client docs https://github.com/snowdrop/vertx-spring-boot/commit/4bc3ff12e28fd5b47ebddf00c70191c962e1a60f
Kafka is a powerful and complex messaging system. But our current starter and it's docs shows only a simple scenario for basic consumer - producer model.
The docs should contain also (maybe it will take an addition to API too):