-
Feb 2nd, 2011, 08:43 AM
#1
CompositeItemProcessor
Hi
I'm trying to set up a CompositeItemProcessor as the processor on a "chunk" but I have a small problem with it.
Basically, the @BeforeStep annotation (or the implementation of StepExecutionListener) is missed (not called) on the CompositeItemProcessor's delegates, so I cannot set and StepExecution on them.
I have found a couple of work arounds - such as using StepSynchronizationManager.getContext().getStepExe cution(), or just making my own CompositeItemProcessor which iterates the delegates and sets the StepExecution - but as I don't like either, I wonder if there is already something there that I could use.
Thanks
-
Feb 3rd, 2011, 02:21 AM
#2
How about honoring the beforeStep and afterStep callbacks in your composite?
-
Feb 3rd, 2011, 03:51 AM
#3
This is what I've done, but shouldn't the composite's delegates be registered as event listeners themselves instead of relying on the composite to handle (or delegate) the events for them?
-
Feb 3rd, 2011, 03:55 AM
#4
well it all depends what you want to do but your composite can offer a delegation service for listeners too as long as the composite itself implements the callback interface.
-
Feb 3rd, 2011, 04:00 AM
#5
Thanks for you reply. I guess you are right and there is nothing really wrong with that, I was just a bit surprise that when I added a composite my original processor stopped working.
-
Feb 3rd, 2011, 04:04 AM
#6
Have a look to the MulticasterBatchListener. You can add that one to your composite and register all your delegates to it.
The class takes care of calling the listener if the registered delegates (any object) implement the proper interface. Very powerful and easy to use
-
Feb 3rd, 2011, 04:11 AM
#7
Excellent, thanks for the tip. I have never hear of that class, I'll have a look to see what I can do with it.
Take care
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules