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

The sample code is wrong in Apache Kafka Connector page

    XMLWordPrintableJSON

Details

    Description

      There is a sample code error in the kafka sink part

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

      The correct wording should be as follows

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

      Attachments

        Issue Links

          Activity

            People

              JasonLee JasonLee
              JasonLee JasonLee
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: