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 2020/04/04 09:35:20 UTC

[GitHub] [flink] imperio-wxm commented on issue #8535: [FLINK-11693] Add KafkaSerializationSchema that uses ProducerRecord

imperio-wxm commented on issue #8535: [FLINK-11693] Add KafkaSerializationSchema that uses ProducerRecord
URL: https://github.com/apache/flink/pull/8535#issuecomment-609003023
 
 
   Hi,
   - flink-1.10
   
   I found `FlinkKafkaProducer0xxx` unable to support  `KafkaSerializationSchema`, because of `FlinkKafkaProducer0xxx` need `KeyedSerializationSchema` or `SerializationSchema` as a serialization tool, I can't initialize like this.
   
   ```java
   public class ProducerSerializationSchema implements KafkaSerializationSchema<ConsumerRecord<byte[], byte[]>> {
       @Override
       public ProducerRecord<byte[], byte[]> serialize(ConsumerRecord<byte[], byte[]> element, @Nullable Long timestamp) {
           // do my logic
           return null;
       }
   }
   
   // flink streaming
   stream.addSink(new FlinkKafkaProducer011(
   	"default",
   	new ProducerSerializationSchema(),
   	properties,
   	FlinkKafkaProducer011.Semantic.EXACTLY_ONCE
   ));
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services