Henrik Johansson
03/04/2024, 2:10 PMKafkaSource.<MyObject>......setDeserializer(new MyObjectSerializer()).setDeserializinfErrorTopic("error-topic").build()Tamir Sagi
03/04/2024, 5:24 PM@Override
public void processElement(final MyObject myObj,
final ProcessFunctionMyObject , MyObject.Context context,
final CollectorMyObject collector) {
if (myObj.isValid()) {
collector.collect(myObj);
} else {
MyObject invalid = MyObject.from(obj);
context.output("invalidOutput", invalid);
}
}
}
then:
var source = KafkaSource.....
var filteredStream = source.process(new CustomProcessFunc());
filteredStream .getSideOutput("invalidOutput").sinkTo(KafkaSink....)'Henrik Johansson
03/04/2024, 5:27 PM.process(...) is where I have landed now actually. It is more or less exactly what you have outlined above. Fighting a little with type erasure but it seems solved now. It's all in all not so bad just hard to know when you haven't done it before.Henrik Johansson
03/04/2024, 5:28 PM