Reputation: 2981
We have 10-15 diff spring batch jobs and for each job we have some common listener like email notifier, job duration listener etc. For this i have added parent job config and some common listener and package them as one lib.
Now in our main concrete jobs, i am using this parent job by extending them in child job context. something like this where "parentJob" is defined in another common lib which has one job listener registered to it.
Now when i run my child job, it is not executing job listener registered in parent job. What could be the isssue?
Parent Job Def
<batch:job id="parentJob" abstract="true">
<batch:listeners>
<batch:listener ref="jobDurationListener"/>
</batch:listeners>
</batch:job>
Child job
<batch:job id="job1" parent="parentJob">
<batch:step id="step1" >
<batch:tasklet transaction-manager="transactionManager" start-limit="100" >
<batch:chunk reader="reader" writer="writer" commit-interval="1" />
</batch:tasklet>
</batch:step>
<batch:listeners>
<batch:listener ref="testListener"/>
</batch:listeners>
</batch:job>
Upvotes: 2
Views: 1453
Reputation: 2981
Sorry for this question. I should have read documentation. After adding merge="true" in child job listener definition it has resolved the issue
Upvotes: 1