【发布时间】:2019-01-06 14:30:06
【问题描述】:
我正在尝试在此处构建 Materialized.as DSL 代码:https://kafka.apache.org/11/javadoc/org/apache/kafka/streams/state/Stores.html
但我得到了错误
incompatible types: org.apache.kafka.common.serialization.Serde<java.lang.Long> cannot be converted to org.apache.kafka.common.serialization.Serde<java.lang.Object>
上线
.withKeySerde(Serdes.Long())
有人知道这里可能出了什么问题吗?
final StreamsBuilder builder = new StreamsBuilder();
KeyValueBytesStoreSupplier storeSupplier = Stores.inMemoryKeyValueStore("mystore");
KTable<Long,String> dataStore = builder.table(
"example_stream",
Materialized.as(storeSupplier)
.withKeySerde(Serdes.Long())
.withValueSerde(Serdes.String()));
【问题讨论】:
-
请添加拓扑/状态存储建设代码
-
请添加代码。
-
抱歉,我添加了构建商店的代码。
-
见minimal reproducible example。添加
builder定义,以及builder使用的所有其他代码 -
Stream Builder 默认 Key 和 Value Serde 配置是什么?
标签: java apache-kafka apache-kafka-streams