Re: Serialization schema
Hi Mohit As you did not give the whole codes of Tuple2Serializerr. I guess the reason is some fields of Tuple2Serializerr do not implement Serializable. 2017-02-24 9:07 GMT+08:00 Mohit Anchlia: > I wrote a key serialization class to write to kafka however I am getting > this error. Not sure why as I've already implemented the interfaces. > > Caused by: java.io.NotSerializableException: com.sy.flink.test. > Tuple2Serializerr$1 > at java.io.ObjectOutputStream.writeObject0( > ObjectOutputStream.java:1184) > at java.io.ObjectOutputStream.defaultWriteFields( > ObjectOutputStream.java:1548) > > And the class implements the following: > > *public* *class* *Tuple2Serializerr* *implements* > > DeserializationSchema >, > > SerializationSchema > { > > And called like this: > > > FlinkKafkaProducer010 > myProducer = *new* > FlinkKafkaProducer010 >( > > "10.22.4.15:9092", // broker list > > "my-topic", // target topic > > *new* Tuple2Serializerr()); // serialization schema > > > >
Re: Writing Tuple2 to a sink
Currently, OutputFormat is used for DataSet, SinkFunction is used for DataStream. Maybe I misunderstand your problem. That will be better if you give more details. 2017-02-24 5:21 GMT+08:00 Mohit Anchlia <mohitanch...@gmail.com>: > This works for Kafka but for the other types of sink am I supposed to use > some type of outputformat? > > On Tue, Feb 21, 2017 at 7:13 PM, 刘彪 <mmyy1...@gmail.com> wrote: > >> Hi >> I think there is a good way in FlinkKafkaProducerBase.java to deal with >> this situation. There is a KeyedSerializationSchema user have to implement. >> KeyedSerializationSchema will be used to serialize data, so that >> SinkFunction just need to understand the type after serialization. >> In your case, I think you can add a SerializationSchema interface in >> SinkFunction. And user have to implement the SerializationSchema, maybe >> named Tuple2SerializationSchema. >> >> 2017-02-22 7:17 GMT+08:00 Mohit Anchlia <mohitanch...@gmail.com>: >> >>> What's the best way to retrieve both the values in Tuple2 inside a >>> custom sink given that the type is not known inside the sink function? >>> >> >> >
Re: Writing Tuple2 to a sink
Hi I think there is a good way in FlinkKafkaProducerBase.java to deal with this situation. There is a KeyedSerializationSchema user have to implement. KeyedSerializationSchema will be used to serialize data, so that SinkFunction just need to understand the type after serialization. In your case, I think you can add a SerializationSchema interface in SinkFunction. And user have to implement the SerializationSchema, maybe named Tuple2SerializationSchema. 2017-02-22 7:17 GMT+08:00 Mohit Anchlia: > What's the best way to retrieve both the values in Tuple2 inside a custom > sink given that the type is not known inside the sink function? >