Results 1 to 3 of 3

Thread: How to get item from RetryListener

  1. #1

    Unhappy How to get item from RetryListener

    Hi,
    1. Could anybody please tell me how to get current processing item in the RetryListener? Actually, RetryListener will call the interface by passing RetryContext, however, it is not easy to get the current processing item from it.

    2. Also, I noticed that Spring Batch does not have an interface like RetryPolicy.handleRetryExhausted, it will give a chance to RetryListener when RetryTemplate is trying to give up an item that has reached Retry Limit number. I think it is very useful since people does not want to skip a item without recording it. Could we add this interface in RetryListener?
    David Yinwei Liu

  2. #2
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    We don't make the item available to retry listeners. But when the retry limit is reached you will still be in a transaction that is going to roll back, so business processing at that point is a bad plan anyway. It is better to use the ItemRecoverer to handle business logic on an exhausted retry because it is guaranteed to be called in a fresh transaction. Does that work for you?

  3. #3

    Default

    Hi Dave,
    thanks you for your reply. I have tried the ItemRecoverer, it is very good. thanks.
    David Yinwei Liu

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •