Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle error path with easy-batch #10

Closed
1 task done
CXwudi opened this issue Jun 7, 2021 · 1 comment
Closed
1 task done

How to handle error path with easy-batch #10

CXwudi opened this issue Jun 7, 2021 · 1 comment
Assignees

Comments

@CXwudi
Copy link
Owner

CXwudi commented Jun 7, 2021

Problem: easy-batch doesn't support Listener class on a single intermidate processor, how to handle error path.
Also for writers, since it already group them in Batch, we can't do much for it

Possible solutions:

  • just write error path logic inside the normal path business code
    • use an ErrHandler class
    • should we use Listener and reply on throwing exps to guide to err path? or should we just use conditions to guide to err path? An: long functions will split, and it will cause return value headache 😫
    • don't write delegate RecordProcessor class with exp handling. It probably won't work for all scenarios
  • let writer class implemented in RecordProcessor class, and use Listener to handle exceptions.
    • This is not a good usage of easy-batch, although it can solve problems easily because with batch writing, we can support writing to DB or cache if we want

Created from JetBrains using CodeStream

@CXwudi CXwudi self-assigned this Jun 7, 2021
@CXwudi CXwudi added this to To do in Further Completion via automation Jun 7, 2021
@CXwudi
Copy link
Owner Author

CXwudi commented Jun 7, 2021

Answer:

  • create an ErrRecorder class to handle writing errors to the /err path
    • ErrRecorder class can not be a subclass of Listener because we want to write any thing possible to error json file
  • use Listener to handle exp in intermediate processing
    • which basically direct the writing process to ErrRecorder
  • let writer class includes the bean of ErrRecorder, this requires us to handle exp code flow by ourself
    • we can't use WriterListener because it takes the whole Batch<> as an argument
  • no listener for reader class, just go hard failure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

No branches or pull requests

1 participant