Skip to content

Fix MultiResourceItemWriter restart at a resource boundary - #5605

Open
noojung wants to merge 1 commit into
spring-projects:mainfrom
noojung:gh-845
Open

noojung wants to merge 1 commit into
spring-projects:mainfrom
noojung:gh-845

Conversation

@noojung

@noojung noojung commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

When a committed chunk fills a resource, MultiResourceItemWriter advances to the next resource, but the execution context can still contain the previous resource's delegate state. Restarting at this boundary passes that stale state to the delegate, causing the restart to fail.

This PR restores delegate state only when the current resource already contains committed items. At a resource boundary, the next write opens the next resource with a fresh execution context.

Adds regression tests for flat file and XML delegates, verifying that restarting preserves the completed resource and writes the remaining items to the next resource.

Resolves #845

When the last commit closed a resource, the restart reopened the
delegate with the state of the previous resource. Now the next resource
is created on the next write, as on a fresh start.

Resolves spring-projects#845

Signed-off-by: Hyunwoo Jung <hyunwoojung@kakao.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MultiResourceItemWriter - Job restart failing (File is not writable) if last file first chunk failed [BATCH-2759]

1 participant