Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-27730

Kafka connector document code sink has an error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.14.4
    • 1.14.4
    • Documentation
    • None
    • Flink 1.14.4

    Description

      Kafka Sink document sample code API call error.

      kafka sink 

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

      setDeliveryGuarantee is the method of KafkaSink not the method of KafkaRecordSerializationSchema, as follows:

       

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

       

       

      Attachments

        1. kafka_sink.png
          18 kB
          liuwei
        2. kafka-sink.png
          55 kB
          liuwei

        Activity

          People

            Unassigned Unassigned
            i-liu liuwei
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: