-
1. Re: Share information runtime between steps
cfang Aug 8, 2016 10:13 AM (in response to joao.santana)1 of 1 people found this helpfulThe primary, standard way of sharing execution data between steps is
javax.batch.runtime.context.JobContext#getTransientUserData
javax.batch.runtime.context.JobContext#setTransientUserData
As the method name implies, the data will be transient and not persistenced to the job repository, nor will it be propagated to partitions of a partitioned execution.
javax.batch.runtime.context.StepContext supports both transient and persistent user data, but it's intended for step, though it's still possible to query it from other steps.
JBeret also supports various CDI scoped beans for sharing job execution data:
org.jberet.cdi.JobScoped
org.jberet.cdi.StepScoped
org.jberet.cdi.PartitionScoped
You can annotate your CDI bean with one of the above scope, and inject it where it's needed.
See example: jsr352/Foo.java at master · jberet/jsr352 · GitHub