Hi,
I have a job with two steps. The first step reads data from a table and creates a list of objects, and the second step writes these objects to a flat file.
I have a class which implements the ItemReader and ItemWriter interfaces. This class is configured as the writer for step 1(jdbcItemreader is the itemreader), and reader for step2(flatfileitemwriter is the writer here).
I configured an afterstep for step 1 which does some final logic and adds the object to a list. I am using an AfterStep annotation to achive this funcationality. My problem is that this afterStep is being called twice.
Here is my configuration:
My questions are:Code:<job id="createFxRatesReconFeed" incrementer="runIncrementer"> <step id="loadFxRates" next="writeFxRates"> <tasklet> <chunk reader="fxRatesReader" writer="fxRatesProcessor" commit-interval="10" /> <listeners> <listener ref="fxRatesProcessor" /> </listeners> </tasklet> </step> <step id="writeFxRates"> <tasklet> <chunk reader="fxRatesProcessor" writer="fxRatesWriter" commit-interval="100" /> </tasklet> </step> </job>
1. Why does my listener's after method gets called twice?
2. The listener documentation states that I can use a pojo and specify the *-method in the configuration. So I expected something like this would work without using the AfterStep annotation or implementing the StepListener, but wrong again. The afterWrite method never got called.
Thanks in advance.Code:<job id="createFxRatesReconFeed" incrementer="runIncrementer"> <step id="loadFxRates" next="writeFxRates"> <tasklet> <chunk reader="fxRatesReader" writer="fxRatesProcessor" commit-interval="10" /> <listeners> <listener ref="fxRatesProcessor" after-step-method="afterWrite" /> </listeners> </tasklet> </step> <step id="writeFxRates"> <tasklet> <chunk reader="fxRatesProcessor" writer="fxRatesWriter" commit-interval="100" /> </tasklet> </step> </job>


Reply With Quote
