问题
I am developing a Spring Batch App -
How to understand or write code for ?
- Identify which chunk has failed in chunk based step?
- How to identify if reader query taking how much time?
回答1:
- Identify which chunk has failed in chunk based step?
A ChunkListener
allows you to achieve that. The method afterChunkError
will be called when an error occurs in a given chunk
- How to identify if reader query taking how much time?
It depends on the reader. ItemReadListener
is called around each read operation, which is not where the query is typically called. For example, the JdbcCursorItemReader
executes the query in openCursor
method. This method is protected, you can override it and time it as needed. For the JdbcPagingItemReader
, the query for each page is called in the doReadPage
method, which is also protected, so you can override it and time it as needed.
来源:https://stackoverflow.com/questions/66136695/identify-which-chunk-has-failed-in-chunk-based-step-in-spring-batch