版本:
scala:2.11.8
spark:2.11
hbase:1.2.0-cdh5.14.0
报错信息:
java.lang.IllegalStateException: Consumer is not subscribed to any topics or assigned any partitions
分析原因:
从指定的主题或者分区获取数据,在poll之前,你没有订阅任何主题或分区是不行的,每一次poll,消费者都会尝试使用最后一次消费的offset作为接下来获取数据的start offset,最后一次消费的offset也可以通过seek(TopicPartition, long)设置或者自动设置
通过源码可以找到:
public ConsumerRecords<K, V> poll(long timeout) {
acquire();
try {
if (timeout < 0)
throw new IllegalArgumentException("Timeout must not be