Interface ChunkListener

All Superinterfaces:
StepListener
All Known Implementing Classes:
ChunkListenerSupport, CompositeChunkListener, MulticasterBatchListener, StepListenerSupport

public interface ChunkListener extends StepListener
Listener interface for the lifecycle of a chunk. A chunk can be thought of as a collection of items that are committed together.
Author:
Lucas Ward, Michael Minella, Mahmoud Ben Hassine, Parikshit Dutta
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The key for retrieving the rollback exception.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Callback after the chunk is executed, outside the transaction.
    default void
    Callback after a chunk has been marked for rollback.
    default void
    Callback before the chunk is executed, but inside the transaction.
  • Field Details

    • ROLLBACK_EXCEPTION_KEY

      static final String ROLLBACK_EXCEPTION_KEY
      The key for retrieving the rollback exception.
      See Also:
  • Method Details

    • beforeChunk

      default void beforeChunk(ChunkContext context)
      Callback before the chunk is executed, but inside the transaction.
      Parameters:
      context - The current ChunkContext
    • afterChunk

      default void afterChunk(ChunkContext context)
      Callback after the chunk is executed, outside the transaction.
      Parameters:
      context - The current ChunkContext
    • afterChunkError

      default void afterChunkError(ChunkContext context)
      Callback after a chunk has been marked for rollback. It is invoked after transaction rollback. While the rollback will have occurred, transactional resources might still be active and accessible. Due to this, data access code within this callback still "participates" in the original transaction unless it declares that it runs in its own transaction. As a result, you should use PROPAGATION_REQUIRES_NEW for any transactional operation that is called from here.
      Parameters:
      context - the chunk context containing the exception that caused the underlying rollback.