With flink sql how to read kafka topic's key

25 Views Asked by At

I have table defined as

CREATE OR REPLACE TABLE table /** mode('streaming')*/
(
        `pk` string,
        `id` string
)WITH (
        'connector' = 'kafka',
        'key.format' = 'json',
        'properties.bootstrap.servers' = 'kafka:29092',
        'properties.group.id' = 'ef_entitlement_local_1',
        'topic-pattern' = 'entitlement_v1__.+?',
        'format' = 'json',
        'scan.startup.mode' = 'earliest-offset',
        'json.timestamp-format.standard' = 'ISO-8601',
        'json.fail-on-missing-field' = 'false',
        'json.ignore-parse-errors' = 'true'
);

Here how do i read kafka topic's key. Seems like key is not part of metadata. I have tried using key.format and key.fields. These are not working.

0

There are 0 best solutions below