spring-projects / spring-projects/spring-batch

Add transactional extension points for synchronization and concurrency

Open
#5,449 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage type: feature
Dominant language
Java
Stars
3k
Forks
2.5k
Avg merge
6d 53m
Merged PRs (30d)
3

Description

Expected Behavior

Spring Batch provides extension points or publishes events at transaction boundaries so that we can synchronize/relate executions to external entities and also control job-level concurrency

Current Behavior

As far as I understand from the code, JobRepository methods are the transaction boundary and there is no simple way to attach listeners into those transactions.

Context

I am working on a batch work item queue where a single job must be executed orderly based on the queued files. I have a work item table in the db that I queue batch requests and then process the queue by a single threaded worker. I use work item id as the single identifying parameter. I'm facing two problems:

  1. I can't keep work item in sync with batch execution status. I think this may be possible through db triggers but not through application layer
  2. Job executions for work items must go through a single controlled api that synchronizes "claim next work item" and "start/restart execution" flows. My logic relies on claiming next available work item unless there are no active executions for that job. But that requires synchronization with the spring-batch operation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the JobRepository methods identified as transaction boundaries and trace how job execution status and concurrency are handled. Define the required application-layer extension points or transaction-boundary events, including how external work items can stay synchronized and how orderly execution is enforced. Done means the proposed behavior and integration points are clear enough to support both use cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.