PAA
PAA

Reputation: 12035

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

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?

Upvotes: 0

Views: 301

Answers (1)

Mahmoud Ben Hassine
Mahmoud Ben Hassine

Reputation: 31710

  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.

Upvotes: 0

Related Questions