Results 1 to 7 of 7

Thread: CompositeItemProcessor

  1. #1
    Join Date
    Jan 2011
    Posts
    10

    Default 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

  2. #2

    Default

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

  3. #3
    Join Date
    Jan 2011
    Posts
    10

    Default

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

    Default

    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. #5
    Join Date
    Jan 2011
    Posts
    10

    Default

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

    Default

    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. #7
    Join Date
    Jan 2011
    Posts
    10

    Default

    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
  •