-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manual commits support #64
Conversation
Did I do the right thing by adding new feature to all subprojects (monix-kafka-9, monix-kafka-10 and other) or should I do it to last version only? |
Many thanks @poslegm this is very useful feature
Perhaps
Yeah, we want it for all versions but it would be better to just start with one so in case of any changes you don't have to apply it 4 times. :) Btw, I'm not convinced we still need this separation but that's just something I'll have to deal with when I find more time. |
The main problem is that val consumer = KafkaConsumerObservable.createConsumer[String,String](consumerCfg, List(topicName))
val source = KafkaConsumerObservable.manualCommit[String,String](consumerCfg, consumer)
...
Await.result(consumer.map(c => c.position(new TopicPartition(topicName, 0))).runToFuture, 60.seconds) But I receive Also I tried to create new kafka consumer but its |
@poslegm FYI I'm about to have more time to spend on OSS and this PR is the first on my list so you can expect some feedback in a couple of days! |
It's a really good news! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once again - sorry it took so long, thank you for your time and patience. :)
Overall I like the API but I think we'll have to be a bit more careful about those commit functions. Hopefully we can think of something!
kafka-1.0.x/src/main/scala/monix/kafka/CommittableOffsetBatch.scala
Outdated
Show resolved
Hide resolved
kafka-1.0.x/src/main/scala/monix/kafka/CommittableOffsetBatch.scala
Outdated
Show resolved
Hide resolved
kafka-1.0.x/src/main/scala/monix/kafka/CommittableOffsetBatch.scala
Outdated
Show resolved
Hide resolved
kafka-1.0.x/src/main/scala/monix/kafka/KafkaConsumerObservable.scala
Outdated
Show resolved
Hide resolved
kafka-1.0.x/src/main/scala/monix/kafka/KafkaConsumerObservable.scala
Outdated
Show resolved
Hide resolved
* KafkaConsumerObservableAutoCommit and KafkaConsumerObservableManualCommit splitted * Commit trait introduced
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks once again, I like it! Just left few suggestions.
So I guess now I'll try to find something for testing offset
@leandrob13
Would you have a time to take a brief look?
I think it looks good but there's a good chance I've missed something. :)
val asyncCb = Callback.forked(cb) | ||
val cancelable = BooleanCancelable() | ||
|
||
val commit: Commit = new Commit { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could probably create it outside this method and reuse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need KafkaConsumer[K, V]
in scope for Commit
creation.
I can move it out to private def commit(consumer: KafkaConsumer[K, V]): Commit = ???
, but I have no ideas how to create it once and reuse later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right, I've missed it. I'll let you know if anything comes to my mind
Added support for manual offsets committing (inspired by alpakka and fs2-kafka).
Reasons and solution was described in #24
I rely on a sctrict code review because I guess that not all my decisions are correct. I could be wrong both in code style and in performance.
Short example of consumer with manual commits:
Unit test for this looks synthetic because I didn't find a way to discover current consumer group offset in Embedded Kafka topic. Maybe someone knows how to do it?