IN Apache Beam how to handle exceptions/errors at Pipeline-IO level

后端 未结 1 1577
悲&欢浪女
悲&欢浪女 2021-01-15 02:21

i am using running spark runner as pipeline runner in apache beam and found an error. by getting the error, my question araised. I know the error was due to incorrec

相关标签:
1条回答
  • 2021-01-15 02:41

    You have to create a custom excetpion handler class to catch that exception for eg;

    need to implement a custom method like this

    public Mycust_Exception(String string) {
        super("Error Obtained by "+string);
    }
    

    here i have just returned the string but can also throw using super() and now you need to declare try-catch blocks where you expect to have exception and also follow PTranformation_level_exceptionHandler_implementation

    and call the throw statement like this in catch block

    throw new Ezflow_Exception("Invalid statement");
    

    this implementation can surely satisfy your query mostly. for Java programing it is one of most common way to implement

    0 讨论(0)
提交回复
热议问题