Announcement Announcement Module
No announcement yet.
How does one "backoff and retry" an entire job? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How does one "backoff and retry" an entire job?


    Here's my use-case:
    • in response to an external event, generate a bunch of alert text messages
    • for each person who has signed up for an alert, try to deliver their message to them
    • if that person lives in a timezone such that the moment of delivery falls in a "blackout period" for them, don't deliver the message to them. try again later

    I have a spring batch job (2.1.1) that has 2 steps: generate, deliver. If, during the delivery step, I find a person for whom it's the middle of the night (maybe they live in Japan or something), I want to skip them and come back later.

    The backoff & retry policies configurable in a FaultTolerantStepFactoryBean don't quite work in this use case because they'll immediately backoff and immediately retry that person's alert. I want to skip them, deliver everyone else's alerts, and then retry them 6 hours later.

    How might one do that with spring batch?

  • #2
    The usual way to do that would be to write the skipped items out somewhere (or mark them in some way), so they can be processed later (e.g. with a special job execution that might be identical to the first, but have a different input source).