我使用Spring Cloud Stream API中的聚合函数从一个主题创建物化视图。 如下所示:
public void process(KStream<Object, Object> input){
input
.peek((key, value) ->{...}
.map((key, value) -> {...}
.groupByKey()
.windowedBy(TimeWindows.of(5000))
.aggregate(Initializer, Aggregator, Materialized)
然后我用以下方法查询我创建的Statestore:
ReadOnlyWindowStore<Object, Object> windowStore =
queryService.getQueryableStoreType("test", QueryableStoreTypes.windowStore());
现在我的问题是在处理方法处理了新事件之后,如何确定此状态存储已更新?是我可以听的还是我可以创造的某种活动?
答案 0 :(得分:0)
您的程序是:
dict = open("lower.lst", 'r').readlines()
with open('dictionary','w') as f:
for word in dict:
if len(word)>=4 and len(word)<=8:
f.write(word)
实际上,最后一个input
.peek((key, value) ->{...}
.map((key, value) -> {...}
.groupByKey()
.windowedBy(TimeWindows.of(5000))
.aggregate(Initializer, Aggregator, Materialized)
返回一个aggregate()
对象。如果您通过KTable
禁用缓存,则可以通过以下方式了解对Materialized
的每次更新:
KTable