As per the documentation ,
https://nightlies.apache.org/flink/flink-docs-release-1.14/docs/connectors/datastream/kafka/

A kafka sink  can be defined as further below
But in fact it fails with





* error: cannot find symbol
.setDeliverGuarantee(DeliveryGuarantee.AT_LEAST_ONCE)
  ^  symbol:   method
setDeliverGuarantee(org.apache.flink.connector.base.DeliveryGuarantee)
location: class
org.apache.flink.connector.kafka.sink.KafkaRecordSerializationSchemaBuilder<java.lang.String>*

What is the correct way?

KafkaSink<String> sink = KafkaSink.<String>builder()
        .setBootstrapServers(brokers)
        .setRecordSerializer(KafkaRecordSerializationSchema.builder()
            .setTopic("topic-name")
            .setValueSerializationSchema(new SimpleStringSchema())
            .setDeliveryGuarantee(DeliveryGuarantee.AT_LEAST_ONCE)
            .build()
        )
        .build();

Regards Hans

Reply via email to