Announcement Announcement Module
Collapse
No announcement yet.
How to implement job timeout Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to implement job timeout

    Hello,

    I'm looking for ideas about the best way to put a timeout parameter around an entire job. I would also consider a similar parameter at the step level. In short, I would like to be able to specify that a Spring Batch job can run for 30 minutes max. If, after 30 minutes the job still running, it would be marked FAIL and terminated. At which point, the scheduler would be free to start future invocations of the job at the normal schedule. I need some sort of callback that is triggered after a fix internal and sees if the the job is still running. If it is, it should terminate it. Any ideas on how I can elegantly define a job (or steps) that could be configured with a timeout parameter? I'm aware of the transaction timeout parameter that is available around steps. However, I'm using web services and there is no formal transaction around these calls so this parameter is of little use to me.

    Any ideas? I figure spring or spring batch must have some hooks that will allow for an elegant solution.

    Andrew

  • #2
    Spring Batch Admin has metrics for StepExecution time and the sample shows how to use a StepExecutionServiceLevelMonitor to generate a JMX notification if a step exceeds a timeout. Turning that into a signal that you can react to locally or remotely is relatively trivial.

    Comment

    Working...
    X