简体   繁体   中英

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:

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?

No, this is not currently possible in 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…

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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