Announcement Announcement Module
No announcement yet.
Listener and step scoped listeners problem Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Listener and step scoped listeners problem

    Hi Lads,

    First of all, thx Dave for creation and fixes against of:
    I didn't verified it yet, but it's nice to see quick reaction.

    I found an issue around step listeners. We have let's say 20 different processes in the application. Each process is separated job defined using batch namespace.

    When we are using inner bean in <listener> tag in some step in one job for some reason listener from other job is used. I didn't investigated it so deep, so I have not even know what rules determine this bug. But the fact is that wrong listener is used for the step.
    Important could be fact that all these listeners are based on the same class (but different configuration and also on LB values).

    for instance, below definition in verious steps of verious jobs:
     <bean step='scope' class='org.classA'>
          .... LB, and static configuration...
    causes that not expected listeners are involved. For some reason listener from different job is involved. Wired, I know but it is.

    There are 2 workarounds we found:
    1. use different classes for inner beans so, based on above example copy classA as classB and use different class for different job. It works than.
    2. Define bean outside of job definition and use "ref" tag to point on it:
    <listener ref="someListener"/>
    Above is working as well.

    For this case we used StepExecutionListener interface. I do not if it's matter but it could be helpfull for investigation. If you cannot reproduce it maybe order of job definitions or order of job executions could have a matter.
    My bet is scope='step' problem in listener inner bean which not work properly and creates singleton instead of step prototype.
    Just to be clear we are using different beans names/ids for jobs and steps.

    Ok, looking for any feedback.

  • #2
    we are using Spring Batch 2.1.1.RELEASE