Coder Social home page Coder Social logo

Comments (6)

chengfang avatar chengfang commented on August 16, 2024

Thanks for your feedback. Section 11.8 Chunk with Listeners of the spec v1.0 Maintenance Release covers your use case in general with detailed flows.

A chunk-type step consists of multiple chunks, and ChunkListener is for these smaller chunks, not for the entire step. When ItemReader.open() is called at the beginning of the step, we haven't come to any chunk yet, why should the ChunkListener be called?

Both javax.batch.api.chunk.listener.ChunkListener#beforeChunk and afterChunk javadoc says that "This method is invoked in the same transaction as the chunk processing." So I would assume the same would apply to onError to mean that chunk transaction here refers to the actual unit of work of chunk processing.

from jsr352.

chengfang avatar chengfang commented on August 16, 2024

You may want to present your issue to batch spec group discussion for more perspectives and suggestions:
https://java.net/projects/jbatch/lists/public/archive

from jsr352.

chengfang avatar chengfang commented on August 16, 2024

Bug 4548 - Add onError to ChunkListener provides some background:
https://java.net/bugzilla/show_bug.cgi?id=4548

from jsr352.

mariok avatar mariok commented on August 16, 2024

Thanks for your explanations and for providing further links/information. I agree with your point of view concerning the call of the ChunkListener.onError() method. I will open a ticket for BatchEE accordingly.

BTW, I think that there is a similar topic concerning the error-processing on step-level. As far as I have seen, JBeret does not call the StepListener.afterStep() method, if an exception is thrown during the step-processing. In the JBatch RI / BatchEE, it seems that the afterStep() method is called even if an exception occurred inside the step. This applies to Chunk- and Batchlet-Steps. The spec also is not very clear about this topic:

The afterStep method receives control after a step execution ends.

Following the logic of ChunkListener.afterChunk(), the afterStep() method should not be called in case of exceptions. But again, this makes it impossible to implement some generic error-processing in form of listeners on step-level.

From my point of view, a top-level error-handling for steps would be great (e.g. in form of a StepListener.onError() method). This would cover exceptions during batchlet-processing as well as exceptions inside chunk-steps, which occur outside of the single chunks (e.g. in the open() and close() methods). I will present this topic for discussion on the spec mailing list together with the original issue. Thanks for your help so far.

from jsr352.

chengfang avatar chengfang commented on August 16, 2024

Sounds good. Let's continue the discussion on batch spec list.

from jsr352.

chengfang avatar chengfang commented on August 16, 2024

batch spec discussion:
https://java.net/projects/jbatch/lists/public/archive/2014-12/message/3

from jsr352.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.