Hi Oscar,

The only way you can define the Kafka message key is by providing a
custom KafkaRecordSerializationSchema to your FlinkKafkaSink via
"setRecordSerializer" method.

KafkaRecordSerializationSchema.serialize method return a ProducerRecord, so
you can set things like the message key, message headers, etc.

On Tue, Jan 23, 2024 at 6:11 AM Oscar Perez via user <user@flink.apache.org>
wrote:

> Hi flink experts!
>
> I have a question regarding apache flink. We want to send an event to a
> certain topic but for some reason we fail to send a proper key with the
> event.
>
> The event is published properly in the topic but the key for this event is
> null.  I only see the method out.collect(event) to publish the event
>
> What should we do in order to see the key in the published message?
>
> Thanks and regards,
> Oscar
>

Reply via email to