You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/09/15 14:37:45 UTC

[GitHub] [flink] JingGe commented on a change in pull request #17288: [FLINK-24292][connectors/kafka] Use KafkaSink in examples instead of …

JingGe commented on a change in pull request #17288:
URL: https://github.com/apache/flink/pull/17288#discussion_r709254557



##########
File path: flink-examples/flink-examples-streaming/src/main/java/org/apache/flink/streaming/examples/statemachine/KafkaEventsGeneratorJob.java
##########
@@ -47,7 +49,16 @@ public static void main(String[] args) throws Exception {
         final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
 
         env.addSource(new EventsGeneratorSource(errorRate, sleep))
-                .addSink(new FlinkKafkaProducer<>(brokers, kafkaTopic, new EventDeSerializer()));
+                .sinkTo(
+                        KafkaSink.<Event>builder()
+                                .setBootstrapServers(brokers)
+                                .setRecordSerializer(
+                                        KafkaRecordSerializationSchema.builder()
+                                                .setValueSerializationSchema(
+                                                        new EventDeSerializer())

Review comment:
       All other serialization classes are following the ***Schema naming convention. Maybe we should consider rename EventDeSerializer to EventSchema in a separate PR.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org