Search code examples
spring-bootjobrunr

JobRunr Job Processing at least once or exactly once?


We want to use JobRunr along with Spring Boot and i am looking at the documentation and it is kinda confusing.
On the main page it says the following thing

Reliable
Once a background job was created without any exception,   
JobRunr takes the responsibility to process it at least once.

And in the FAQ page https://www.jobrunr.io/en/documentation/faq/ it says

How does JobRunr make sure to only process a job once?

I guess what is written in the FAQ it means that it uses optimistic locking to do the coordination that the job is processed once - but this does not mean it will get processed once exactly - because it might get processed, but not updated in the DB - which means double processing can occur.
Am i getting it correct?

Also from the FAQ i can't see what happens when the status is updated to PROCESSING but the actual processing fails. This is not explained there.

Thanks a lot for the feedback.
Best Regards


Solution

  • It seems that this has been answered already in the Discussion tab in Github.

    If no exceptions during the run of your job, JobRunr
    will process your job exactly once by means of optimistic locking.
    
    If however your job is existing out of multiple phases and
    one of those last phases fails, all the prior phases will 
    be re-executed when your job is retried.
    

    https://github.com/jobrunr/jobrunr/discussions/358