Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache kafka Kafka Streams Binding:无法获取状态存储,因为流线程已分配,未运行_Apache Kafka_Apache Kafka Streams_Spring Cloud Stream - Fatal编程技术网

Apache kafka Kafka Streams Binding:无法获取状态存储,因为流线程已分配,未运行

Apache kafka Kafka Streams Binding:无法获取状态存储,因为流线程已分配,未运行,apache-kafka,apache-kafka-streams,spring-cloud-stream,Apache Kafka,Apache Kafka Streams,Spring Cloud Stream,我使用Spring云流Kafka绑定的基础设施进行流处理 以下是KafkaStream的主要方法: private static final String READ_STORE_NAME = "readMessageStore"; @Bean public Consumer<KStream<String, ContentModel>> filter() { return in -> in.groupByKey(Grouped.wit

我使用Spring云流Kafka绑定的基础设施进行流处理

以下是KafkaStream的主要方法:

private static final String READ_STORE_NAME = "readMessageStore";

  @Bean
public Consumer<KStream<String, ContentModel>> filter() {
    return in -> in.groupByKey(Grouped.with(Serdes.String(), new JsonSerde<>(ContentModel.class)))
            .reduce(this::mergeObjects, Materialized.as(READ_STORE_NAME));
}

private ContentModel mergeObjects(final ContentModel reducer, final ContentModel materialized) {      
    return reducer;
}
我部署了2个应用程序实例,它们由ApplicationId分隔,如下所示:

spring.cloud.stream.kafka.streams.binder.functions.filter.applicationId = <Id>
spring.cloud.stream.kafka.streams.binder.functions.filter.applicationId=
但在部署阶段,我收到:

IllegalStateException:检索状态存储时出错:j readMessageStore

原因:org.apache.kafka.streams.errors.InvalidStateStoreException:无法获取状态存储readMessageStore,因为流线程已分配,未运行

从中我发现,我需要(显然)在查询之前等待第二个运行状态


但是,考虑到本例中的所有状态转换都实现了“隐藏”状态,我如何在Spring Cloud Stream Kafka绑定环境中设置此延迟呢?

您需要启用运行状况指示器,然后编写侦听器,以便在第二次运行之前对其进行重新平衡监控

参考此

您使用的是哪家经纪人?从您链接的另一个SO线程来看,如果您使用的代理>=2.2.0,那么这已经修复了?你试过了吗?在卡夫卡的案例中,据我所知,经纪人是“幕后黑手”。我得到了关于健康指标的信息。你能提供一些关于编写监听器的更多细节吗?可能是一些有用的参考?
spring.cloud.stream.kafka.streams.binder.functions.filter.applicationId = <Id>