Repository navigation
Do you use a persistent job repository? #4874
Replies: 7 comments 1 reply
|
We have use cases where a Spring Batch job is implemented as a command line application (e.g., a Spring Boot executable JAR), and such an application is scheduled on Unix via cron on at least two servers, with a delta between each schedule. As all application executions share the same database for batch metadata, we can ensure that the corresponding job runs at most once (given that the same identifying parameters are provided), and is also tolerant to failures or planned downtime. We also have other use cases where batch metadata is not relevant, and such applications/jobs run as command-line applications, but with an in-memory database like H2 (we will migrate to the |
|
Because of its constraints, ResourcelessJobRepository often ends up being unusable, and I hope that can be improved. It’s not only an issue when multiple jobs are invoked concurrently; you also can’t use it in a JobStep that calls another job from within a job. Although it had similar concurrency issues, in terms of applicability (scope of use), I feel the older MapJobRepository was better. |
|
The following issue shows the limitation of |
|
The
The Javadoc of the class and the reference docs mention that this implementation is not expected to be used in any concurrent environment:
Same here, this is a use case where you have two job executions: one for the outer job and one for the inner sub job. I believe the expectations when using this class are well documented in the javadocs, reference docs and the migration guide to v6. |
|
@fmbenhassine In the following issue, I shared some additional ideas for further improving ResourcelessJobRepository: |
|
We use a persistent job repository in production to be able to handle crashes. For testing non-persistent. |
|
We use a persistent job repository in production:
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
The answer is most likely "it depends", but we would like to know how frequently users do actually need a persistent store for batch meta-data.
If needed, please add a comment and elaborate on your use case(s).
21 votes ·
All reactions