You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a JobStep, there is no means to pass values from the execution context of the child job run in the JobStep back to the parent step, similar to how an ExecutionContextPromotionListener would be used to promote values from a child step back up to the parent job. This cannot be achieved in the current design, in part, because the JobExecution of the job being called is only scoped to the JobStep.doExecute method.
It would be nice to have an interface that specified actions to be performed between the child JobExecution and parent StepExecution. The JobStep.determineStepExitStatus method is one example of code that could implement this interface and the Job to Step Execution Context Promotion would be another example.
Background:
I'm developing a small report-running framework to add to an application that uses Spring Batch for a number of integration tasks. The design consists of three steps:
Retrieve a Report Definition from a database table (contains a Job Name, static parameters to pass to job, list of users who receive the report) and put that into the Step/Job Execution Context. This step is accomplished via a tasklet.
Use the Report Definition in the Execution context to create a JobStep. The job would perform whatever logic that needs to be done and creates a file. The name of this file would be provided in the child job's execution context to be passed to the next step in the parent job.
Distribute that file out to the users (probably another tasklet).
Here's what the second step currently looks like, pre-workaround mentioned below:
Use an external data store (database table) to store the information.
Subclass JobScope, copying the doExecute method and rewriting the determineStepExitStatus to also perform the task of JobExectution -> StepExecution promotion. This is the approach I am currently using as a workaround
The text was updated successfully, but these errors were encountered:
I've been trying to achieve something similar and also found that there is no good way to achieve this without manually persisting the data in the JobSteps Job in an external table. It would be neat to have a way to copy the data from the JobSteps JobExecutionContext to the Parent's JobExecution context.
This request comes from the Stack Overflow question posed here:
https://stackoverflow.com/questions/77649370/promote-execution-context-from-jobstep-to-calling-step
When using a JobStep, there is no means to pass values from the execution context of the child job run in the JobStep back to the parent step, similar to how an ExecutionContextPromotionListener would be used to promote values from a child step back up to the parent job. This cannot be achieved in the current design, in part, because the JobExecution of the job being called is only scoped to the JobStep.doExecute method.
It would be nice to have an interface that specified actions to be performed between the child JobExecution and parent StepExecution. The JobStep.determineStepExitStatus method is one example of code that could implement this interface and the Job to Step Execution Context Promotion would be another example.
Background:
I'm developing a small report-running framework to add to an application that uses Spring Batch for a number of integration tasks. The design consists of three steps:
Here's what the second step currently looks like, pre-workaround mentioned below:
Alternatives considered:
The text was updated successfully, but these errors were encountered: