Issue Details (XML | Word | Printable)

Key: BATCH-553
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Lucas Ward
Reporter: Lucas Ward
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Spring Batch

There is no way to set the ChunkOperations ExceptionHandler in any factory bean

Created: 03/Apr/08 11:02 AM   Updated: 07/Aug/08 10:07 AM
Component/s: Core
Affects Version/s: 1.0.0
Fix Version/s: 1.0.1

Time Tracking:
Not Specified


 Description  « Hide
The SimpleStepFactoryBean has a setter for the ExceptionHandler, but it isn't used anywhere.

 All   Comments   Work Log   Change History   FishEye   Builds      Sort Order: Ascending order - Click to sort in descending order
Lucas Ward added a comment - 03/Apr/08 11:28 AM
I see what the ExceptionHandler is used for now, it sets the step level. The problem is that there's no way to set it at the Chunk level. The only reason it's needed in this case if that my client wants to be able to say that certain exceptions thrown in the write don't cause rollbacks.

Lucas Ward added a comment - 03/Apr/08 11:34 AM
Created an issue against 1.1 for adding the rollback and not-for-rollback list: BATCH-554

Dave Syer added a comment - 03/Apr/08 11:57 AM
Which feature should be in 1.0.1, then? It seems like it would be more in keeping with the existing step factory beans to add another exception list (which would argue for BATCH-554, not this one).

There is also a good workaround to both issues - to create your own ItemOrientedStep by hand, or implement a new step factory bean. So I actually don't think we should address either issue in 1.0.1.

Lucas Ward added a comment - 03/Apr/08 02:25 PM
I agree that there's a workaround by creating a new StepFactoryBean implementation (which one client did), but it's debatable about whether that's a good one. I agree that BATCH-554 is the best solution to this problem. However, I still think in the short term we could give access to the chunk exception handler, and potentially even the completion policy. Another client wanted to be able to pull the commit interval from the JobParameters. It's tough to ask them to create a new FactoryBean, since there's so much other setup around the operations, such as listeners, etc. I know we need to be careful though as to what we provide, the better solution may be to just make sure we've designed the factory beans in such a way that they can be inherited from easily. For example, exposing a getter for the chunkOperations.

Dave Syer added a comment - 08/Apr/08 09:00 AM
I still don't think we can do anything for 1.0.1. It would be best perhaps if you tidy up the comments here so that it is clear what you think is achievable in the scope of 1.0.1.

Simply injecting the exception handler for the chunk template might be counterproductive - we decided we wanted factory beans because there were too many options and they weren't very easy to choose in the step implementations. If we start adding more features to the factory beans we might end up back in the same boat. It would be better to take it slowly.

I can't see a way to allow JobParameters to be injected into a step with any simple extension to the existing factory. There is another issue for that anyway.

Ther is always the RepeatOperationsStepFactoryBean for clients who want more control.

Lucas Ward added a comment - 08/Apr/08 09:39 AM
Dave,

I agree one the setter for the ExceptionHandler, but it still seems like adding a getter for the chunkOperations wouldn't be too bad, since there's already one for the StepOperations, it would allow people who want to subclass the option.

Lucas Ward added a comment - 08/Apr/08 10:56 PM
I added the getter for the ChunkOperations to the SimpleStepFactoryBean. Since we were already providing a getter for StepOperations, and the same class was already creating the chunk operations, it made sense.

Dave Syer added a comment - 07/Aug/08 10:07 AM
Assume closed as resolved and released