Skip to content
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

Subscribe.AutoPartitionWithManualOffset closes over actor instance #111

Closed
janm399 opened this issue May 9, 2017 · 2 comments
Closed

Subscribe.AutoPartitionWithManualOffset closes over actor instance #111

janm399 opened this issue May 9, 2017 · 2 comments

Comments

@janm399
Copy link
Member

janm399 commented May 9, 2017

When sending Subscribe.AutoPartitionWithManualOffset to the KafkaConsumerActor, the assignedListener and revokedListener functions may end up capturing the actor instance. The current API also makes it difficult to use non-blocking code to load the offsets.

It would be more convenient to have

final case class AutoPartitionWithManualOffset(
  topics: Iterable[String],
  assignedListener: List[TopicPartition] => Future[Offsets],
  revokedListener: List[TopicPartition] => Future[Unit]
) extends Subscribe

For safe use in actors, it would be useful to have a wrapper around assignedListener and revokedListener that works by asking a supplied ActorRef for a response (Offsets) to AssignedListeners(topics: List[TopicPartition) and RevokedListeners(...).

@jpallari
Copy link
Contributor

Yeah, that would be nice indeed. The problem is that the underlying Java client doesn't support asynchronous listeners. The Java client revocation/assignment hooks must complete their work during the call.

@janm399
Copy link
Member Author

janm399 commented May 10, 2017

I tried it at https://github.com/janm399/scala-kafka-client/tree/fmp; as far as I can tell, the main point of integration is consumer.seek(...), which can happen in onComplete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants