Class ClusterAwareAggregator
java.lang.Object
org.springframework.batch.core.partition.support.RemoteStepExecutionAggregator
io.github.jchejarla.springbatch.clustering.api.ClusterAwareAggregator
- All Implemented Interfaces:
org.springframework.batch.core.partition.StepExecutionAggregator
public class ClusterAwareAggregator
extends org.springframework.batch.core.partition.support.RemoteStepExecutionAggregator
An extension of Spring Batch's
RemoteStepExecutionAggregator that provides
custom callbacks for handling the success or failure of partitioned step executions
in a clustered environment.
This aggregator delegates the core aggregation logic to an internal
DefaultStepExecutionAggregator but intercepts the final status
to invoke specific success or failure callbacks defined by the
ClusterAwareAggregatorCallback interface.
-
Constructor Summary
ConstructorsConstructorDescriptionClusterAwareAggregator(ClusterAwareAggregatorCallback clusterAwareAggregatorCallback, org.springframework.batch.core.repository.JobRepository jobRepository) Constructs a newClusterAwareAggregatorwith the specified callback. -
Method Summary
Modifier and TypeMethodDescriptionvoiddoHandleFailed(Collection<org.springframework.batch.core.step.StepExecution> executions) Handles the failed case for a collection of step executions.voiddoHandleSuccess(Collection<org.springframework.batch.core.step.StepExecution> executions) Handles the success case for a collection of step executions.Methods inherited from class org.springframework.batch.core.partition.support.RemoteStepExecutionAggregator
aggregate, setDelegate, setJobRepository
-
Constructor Details
-
ClusterAwareAggregator
public ClusterAwareAggregator(ClusterAwareAggregatorCallback clusterAwareAggregatorCallback, org.springframework.batch.core.repository.JobRepository jobRepository) Constructs a newClusterAwareAggregatorwith the specified callback.- Parameters:
clusterAwareAggregatorCallback- The callback to be invoked on success or failure.jobRepository- The Spring Batch job repository used to reload persisted partition step executions before aggregation. Required as of Spring Batch 6, which removed the no-argumentRemoteStepExecutionAggregatorconstructor.
-
-
Method Details
-
doHandleSuccess
public void doHandleSuccess(Collection<org.springframework.batch.core.step.StepExecution> executions) Handles the success case for a collection of step executions. This method simply delegates the call to the configuredClusterAwareAggregatorCallback.onSuccess(Collection).- Parameters:
executions- A collection ofStepExecutioninstances that have completed successfully.
-
doHandleFailed
public void doHandleFailed(Collection<org.springframework.batch.core.step.StepExecution> executions) Handles the failed case for a collection of step executions. This method simply delegates the call to the configuredClusterAwareAggregatorCallback.onFailure(Collection).- Parameters:
executions- A collection ofStepExecutioninstances where at least one has failed.
-