How to handle errors in custom MapFunction correctly?

Viewed 1376

I have implemented MapFunction for my Apache Flink flow. It is parsing incoming elements and convert them to other format but sometimes error can appear (i.e. incoming data is not valid).

I see two possible ways how to handle it:

  • Ignore invalid elements but seems like I can't ignore errors because for any incoming element I must provide outgoing element.
  • Split incoming elements to valid and invalid but seems like I should use other function for this.

So, I have two questions:

  1. How to handle errors correctly in my MapFunction?
  2. How to implement such transformation functions correctly?
2 Answers
Related