Announcement Announcement Module
No announcement yet.
How to stop a Spring Batch job using curl/json Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to stop a Spring Batch job using curl/json

    Hi, everyone.

    Using commands from unix and/or cygwin such as this:

    curl -v -d jobParameters=

    ...I am able to launch a Spring Batch job. This basically emulates what one can do in the Spring Batch Admin web pages at a command line level.

    I learned all this from the reference manual yesterday:

    It describes several such curl/json command patterns, but one command pattern it does not describe is how to stop and abandon Spring Batch jobs. How do I do that with curl/json?

    I've googled around, trying to find the syntax. I figure it's going to be something like "-d JobParameters=stop=true" or "-d JobParameters=status=abandon" or maybe "fail=true" instead "fail=false"?

    Where is all this documented at Spring please? Can't find it yet.

    Ben Ethridge

  • #2
    While I'm not a curl guru, what you need to do an HTTP delete to the url http://localhost:8080/MyWeb/batch/jobs/executions/<execution_id> with the parameters stop=stop. If you can't do a true HTTP delete, you can add the _method=DELETE parameter (this is what the stop button does in Spring Batch Admin.