Class MyChunkListener

  • All Implemented Interfaces:
    jakarta.batch.api.chunk.listener.ChunkListener, jakarta.batch.api.listener.StepListener

    @Named("myChunkListener")
    public class MyChunkListener
    extends jakarta.batch.api.chunk.listener.AbstractChunkListener
    implements jakarta.batch.api.listener.StepListener
    Originally this class was going to be used to check that we could view an earlier-thrown exception via StepContext.getException() in each of afterChunk(), onError(Exception). After a mailing list comment that we should relax the requirements on the implementation to make the exception immediately visible to other artifacts, we agreed to only check that we saw the expected exception in afterStep(). The quick change then was to recast this MyChunkListener as both a ChunkListener and StepListener.
    • Constructor Detail

      • MyChunkListener

        public MyChunkListener()
    • Method Detail

      • beforeChunk

        public void beforeChunk()
                         throws Exception
        Specified by:
        beforeChunk in interface jakarta.batch.api.chunk.listener.ChunkListener
        Overrides:
        beforeChunk in class jakarta.batch.api.chunk.listener.AbstractChunkListener
        Throws:
        Exception
      • beforeStep

        public void beforeStep()
                        throws Exception
        Specified by:
        beforeStep in interface jakarta.batch.api.listener.StepListener
        Throws:
        Exception
      • afterStep

        public void afterStep()
                       throws Exception
        Specified by:
        afterStep in interface jakarta.batch.api.listener.StepListener
        Throws:
        Exception