Announcement Announcement Module
No announcement yet.
CompositeItemProcessor Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • CompositeItemProcessor


    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.


  • #2
    How about honoring the beforeStep and afterStep callbacks in your composite?


    • #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?


      • #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.


        • #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.


          • #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


            • #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