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

Misleading error message in NotSubscribedException #981

Closed
danielleontiev opened this issue May 20, 2022 · 1 comment · Fixed by #1303
Closed

Misleading error message in NotSubscribedException #981

danielleontiev opened this issue May 20, 2022 · 1 comment · Fixed by #1303

Comments

@danielleontiev
Copy link

danielleontiev commented May 20, 2022

The message says "consumer is not subscribed to any topics". Also, in javadoc comments in KafkaConsume.scala it's mentioned multiple times that

* @note you have to first use `subscribe` to subscribe the consumer
    *       before using this `Stream`. If you forgot to subscribe, there
    *       will be a [[NotSubscribedException]] raised in the `Stream`.

But it's not completely correct. To avoid the exception you could either subscribe to the topic or assign partitions manually. For example, underlying org.apache.kafka.clients.consumer.KafkaConsumer uses the following error message inside its poll method:

throw new IllegalStateException("Consumer is not subscribed to any topics or assigned any partitions")
@aartigao
Copy link
Contributor

aartigao commented Mar 3, 2024

Fair. The ScalaDoc seems to be updated, but the exception message not. I'm fixing this.

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

Successfully merging a pull request may close this issue.

2 participants