In Flink, the endpoint of your datastream takes the form of a data sink. These sinks will usually connect to a database or streaming platform. As data flows through the datastream it eventually gets pushed into the sink through the use of one of Flink's connectors. In this video, we'll introduce the concept of a Flink data sink and show how you can create a simple Kafka sink.
KafkaRecordSerializationSchema<MyClass> serializer = KafkaRecordSerializationSchema.<MyClass>builder() .setTopic("topic_name") .setValueSerializationSchema( new JsonSerializationSchema<>() ) .build();
KafkaSink<MyClass> sink = KafkaSink.<MyClass>builder() .setKafkaProducerConfig(config) .setRecordSerializer(serializer) .setDeliveryGuarantee(DeliveryGuarantee.EXACTLY_ONCE) .build();
stream .sinkTo(sink) .name("sink_name");
We will only share developer content and updates, including notifications when new content is added. We will never send you sales emails. 🙂 By subscribing, you understand we will process your personal information in accordance with our Privacy Statement.