Class ChunkTaskExecutorItemWriter<T>

java.lang.Object
org.springframework.batch.integration.chunk.ChunkTaskExecutorItemWriter<T>
Type Parameters:
T - type of items
All Implemented Interfaces:
StepExecutionListener, StepListener, ItemWriter<T>

public class ChunkTaskExecutorItemWriter<T> extends Object implements ItemWriter<T>, StepExecutionListener
Similar to ChunkMessageChannelItemWriter, this item writer submits chunk requests to local workers from a TaskExecutor instead of sending them over a message channel to remote workers.
Since:
6.0
Author:
Mahmoud Ben Hassine
See Also:
  • Constructor Details

    • ChunkTaskExecutorItemWriter

      public ChunkTaskExecutorItemWriter(ChunkProcessor<T> chunkRequestProcessor, org.springframework.core.task.TaskExecutor taskExecutor)
      Parameters:
      chunkRequestProcessor - the chunk processor to process chunks
      taskExecutor - the task executor to submit chunk processing tasks to
  • Method Details

    • write

      public void write(Chunk<? extends T> chunk)
      Description copied from interface: ItemWriter
      Process the supplied data element. Will not be called with any null items in normal operation.
      Specified by:
      write in interface ItemWriter<T>
      Parameters:
      chunk - of items to be written. Must not be null.
    • beforeStep

      public void beforeStep(StepExecution stepExecution)
      Description copied from interface: StepExecutionListener
      Initialize the state of the listener with the StepExecution from the current scope.
      Specified by:
      beforeStep in interface StepExecutionListener
      Parameters:
      stepExecution - instance of StepExecution.
    • afterStep

      public ExitStatus afterStep(StepExecution stepExecution)
      Description copied from interface: StepExecutionListener
      Give a listener a chance to modify the exit status from a step. The value returned is combined with the normal exit status by using ExitStatus.and(ExitStatus).

      Called after execution of the step's processing logic (whether successful or failed). Throwing an exception in this method has no effect, as it is only logged.

      Specified by:
      afterStep in interface StepExecutionListener
      Parameters:
      stepExecution - a StepExecution instance.
      Returns:
      an ExitStatus to combine with the normal value. Return null (the default) to leave the old value unchanged.