spring batch - Listener problems with ItemWriteListener and ChunkListner -
i have nebulous problem concerning listeners within spring batch chunk process.
my chunk configuration listed below:
<batch:chunk reader="processmidxdbitemreader" processor="midxitemprocessor" writer="midxcompositeitemwriter" processor-transactional="false" reader-transactional-queue="false" skip-limit="${cmab.batch.skip.limit}" commit-interval="#{jobparameters['toprocess']==t(de.axa.batch.ecmcm.cmab.util.cmabconstants).type_postausgang ? '${consumer.global.pa.midx.readcount}' : '${consumer.global.pe.midx.readcount}' }" cache-capacity="20"> <batch:skippable-exception-classes> <batch:include class="de.axa.batch.ecmcm.cmab.util.cmabprocessmidxexception" /> </batch:skippable-exception-classes> <batch:retryable-exception-classes> <batch:include class="de.axa.batch.ecmcm.cmab.util.cmabtechnicalmidxexception" /> <batch:include class="de.axa.batch.ecmcm.cmab.util.cmabtechnicalexception" /> </batch:retryable-exception-classes> <batch:retry-listeners> <batch:listener ref="logretrylistener"/> </batch:retry-listeners> <batch:listeners> <batch:listener> <bean id="midxprocessskiplistener" class="de.axa.batch.ecmcm.cmab.core.batch.listener.cmabdbskiplistener" scope="step"> <constructor-arg index="0" value="#{jobparameters['errorstatus']}" type="java.lang.string"/> </bean> </batch:listener> <batch:listener> <bean id="cmabchunklistener" class="de.axa.batch.ecmcm.cmab.core.batch.listener.cmabchunklistener" scope="step"/> </batch:listener> </batch:listeners> </batch:chunk>
the midxprocessskiplistener implements itemprocesslistener , itemwritelistener override methods. cmabchunklistener bean implements chunklistener.
so problem: if write error occured expected that...
- a)
afterchunkerror
of "cmabchunklistener" called - b)
onwriteerror
of "midxprocessskiplistener" called.
but unfortunately just afterchunkerror
method called. onwriteerror
method ignored?!?
if comment cmabchunklistener
bean within configuration (see above) onwriteerror
of midxprocessskiplistener
indeed called.
what cause behaviour? why isn't possible have 2 seperate listener within chunk process? aim both methods called.
any appreciated.
many in advance.
regards,
bodo stockschlaeder
out of curiousity: solution in case define listener out of chunk configuration, means within batch tasklet.
</batch:chunk> <batch:listeners> <batch:listener ref="midxsteplistener"/> <batch:listener> <bean id="cmabchunklistener" class="de.axa.batch.ecmcm.cmab.core.batch.listener.cmabchunklistener" scope="step"/> </batch:listener> </batch:listeners> </batch:tasklet> </batch:step>
this solution worked me :-)
nevertheless responses.
kind regards, bodo
Comments
Post a Comment