3

I created this record:

new ProducerRecord(topic = "petstore-msg-topic", key = msg.username, value = s"${msg.route},${msg.time}")

I want now to do something like this:

CREATE STREAM petstorePages (KEY, route VARCHAR, time VARCHAR) \
                  WITH (KAFKA_TOPIC='petstore-msg-topic', VALUE_FORMAT='DELIMITED');

Is there a possibility to access the key in the Stream creation or do I have to include the key also in the value?

Matthias J. Sax
  • 59,682
  • 7
  • 117
  • 137
pme
  • 14,156
  • 3
  • 52
  • 95

1 Answers1

3

It's added automatically and called ROWKEY

KSQL adds the implicit columns ROWTIME and ROWKEY to every stream and table, which represent the corresponding Kafka message timestamp and message key

https://docs.confluent.io/current/ksql/docs/syntax-reference.html#id16

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245