Identify which chunk has failed in chunk based step in Spring Batch

廉价感情. 提交于 2021-02-20 05:14:17

问题


I am developing a Spring Batch App -

How to understand or write code for ?

  1. Identify which chunk has failed in chunk based step?
  2. How to identify if reader query taking how much time?

回答1:


  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

  1. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!