简体   繁体   English

使用与 Kafka 主题消息键相同的 ROWKEY 创建 KSQL 表

[英]Create KSQL table with ROWKEY same as Kafka topic message key

I'm creating a KTable from a topic with JSON value format, the producers of the topic also include a key for each message at Kafka level and JSON message itself contains a JSON property called key which I use as ROWKEY in the following statement:我正在从具有 JSON 值格式的主题创建 KTable,该主题的生产者还包括 Kafka 级别的每条消息的键,JSON 消息本身包含一个名为key的 JSON 属性,我在以下语句中用作ROWKEY

create table SUBSCRIPTIONS(key varchar, application_id varchar, subscription_id varchar) with (KAFKA_TOPIC='INCOMING_SUBSCRIPTIONS', VALUE_FORMAT='JSON', KEY='key');

Is there a way to create a KSQL table using the key from the messages in the the topic as ROWKEY so I don't have to duplicate the key value at topic level?有没有办法使用主题中消息的键作为ROWKEY创建 KSQL 表,这样我就不必在主题级别复制键值?

No, this is not currently possible in KSQL.不,这在 KSQL 中目前是不可能的。 The key needs to be present in the message value as well as the key itself.密钥需要存在于消息值中以及密钥本身。

There is work underway for KSQL 5.2 that will improve how keys are handled, so stay tuned… KSQL 5.2 的工作正在进行中,将改进密钥的处理方式,敬请期待……

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM