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")
The message says
"consumer is not subscribed to any topics"
. Also, in javadoc comments inKafkaConsume.scala
it's mentioned multiple times thatBut it's not completely correct. To avoid the exception you could either
subscribe
to the topic orassign
partitions manually. For example, underlyingorg.apache.kafka.clients.consumer.KafkaConsumer
uses the following error message inside itspoll
method: