Announcement Announcement Module
Collapse
No announcement yet.
Pause and Resume Job Execution Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pause and Resume Job Execution

    Hi All,
    I want to extend spring batch functionality about to provide Long Running transaction. In particular I want the following sequential use case:
    1)Partition step delegating work to asynch agressive consumers (JMS messages sent over a request queue)
    2)Master step is paused-->Job is paused, releasing its thread to the pool.
    3) Reply messages arrive on a reply queue.
    4)A message listener consumes reply message, resuming the paused job.

    I think that this scenario is very similar to the "Pause and Resume Job Execution" use case that I found on the spring batch site, but I don't understand if it is supported by last release of Spring batch. I didn't find anything about that in the sources or in the samples.
    Any help will be appreciated.
    Thanks

  • #2
    That use case is implemented in Spring Batch Integration (lots of tests here: https://fisheye.springsource.org/bro...egration/chunk).

    Comment


    • #3
      Hi Dave,
      thanks for the link , I found useful implementation about Remote chunking or partitioning with JMS.
      But I didn't see any code about Pause the JobExecution (Something like Batch.Status = PAUSED or WAITING or whatever else) and Resume the same JobExecution without create another new one (something like JobOperator.resume(Job job, String jobExecutionId)).

      Where should I search about the above scenario ?

      Comment


      • #4
        Is this the same use case: http://forum.springsource.org/showthread.php?t=94173?

        Comment


        • #5
          It's a similar use case but I don't want a "remote step", but I need two different jobs. I'm searching for what you explain here:
          If I understood the use case (a bit thin on details) I have seen this kind of thing implemented using a <stop/> and a message listener with a job launcher to wake up the job and continue it. In fact this is the main reason <stop/> exists in the state machine.
          I didn't read in the documentation about a "<stop/>" tag.
          Morover I found this Jira:
          'https://jira.springsource.org/browse/BATCH-858?page=com.atlassian.jirafisheyeplugin%3Afisheye-issuepanel#issue-tabs'
          where something was implemeted about Pause (but not Resume) of a job, and I still found nothing about that in the last release.
          Anyway, I'm trying to implement my use case starting from the MessageChannelPartitionHandler in Spring Integration (erasing the last few lines of code about receive activity) and then implement:
          1) A "pausing" Partition Step: as the built-in partition step, without the aggregation fase, but only set a Paused Status after having sent remote job execution requests on the "request queue"
          2) An Aggregator listening on the remote job execution result queue, updating the partitioned steps execution status.
          3)When a completation policy will be satisfied, the aggregator execute the resume of the job.
          4) A new method "resume" on the JobOperator interface.

          Any advices ?
          Last edited by dantelmo; Sep 6th, 2010, 11:47 AM.

          Comment


          • #6
            Hi dantelmo,
            our use case sounds very similer ..
            after getting dave's advice in the linked thead above , i saw that using
            JobOperator restart method actually resumes from the stopped point to the next step.
            more specificaly : inside an afterStep() method within a tasklet i used a JobOperator to stop the job (and save the stopped jobExecution id)
            and after that from an mdb (or any other listener or event handler) recieve the jms reply containing the job execution id it relates to, and sending it to JobOperator restart method to continue from the next step..

            hope this helps ..

            Comment


            • #7
              Hi noam.
              thanks for sharing infomations.. Have you found a way to restart the same JobExecution that was stopped previously (without creating a new one) ?
              From my unit tests I see that, if my last stopped JobExecution id was X, calling JobOperator.restart(X) create another JobExecution with X+1 id.
              That's not what I mean for "Resume".

              For Dave:
              I found <stop> example, sorry for my previously wrong question.

              Comment


              • #8
                i also saw this, but i think this is consistant with the definition of job execution and instance .. the same job instance is used of course ..
                please update if you find a solution that is more apropriate.
                thanks

                Comment

                Working...
                X