|
|
Tasklet without ItemReader amp; ItemWriter ?
lt;batch:job id=quot;extractquot;gt;
lt;!-- Step One is to Create the File amp; store it locally --gt;
lt;batch:step id=quot;generateFilequot; gt;
lt;batch:taskletgt;
lt;batch:chunk reader=quot;readerquot; writer=quot;writerquot; commit-interval=quot;20quot; /gt;
lt;/batch:taskletgt;
lt;/batch:stepgt;
lt;!-- Step Two is to Create the File amp; store it locally --gt;
lt;batch:step id=quot;transferFilequot;gt; lt;batch:tasklet gt; lt;batch:chunk reader=quot;dummyItemReaderquot; processor=quot;FileFTPquot; writer=quot;dummyItemWriterquot; commit-interval=quot;5quot; /gt; lt;/batch:taskletgt;
lt;/batch:stepgt;
lt;/batch:jobgt;
I am using Spring batch 2.1.5
Please look at the above Code. Here i am having 2 steps
1. To generate the file by fetching the data from tables.
2. FTP the generated file to some destination.
In the step 2, i am using dummy reader amp; writer just because those are mandatory in a tasklet even though it is not serving any purpose.
I have added the logic to FTP the file in process method of the processor(FileFTP class).
Is there any way so that i can avoid the dummy reader amp; writer which are of no use?
Or is there any way where i can call a method in that step ?(i can add the whole code which is present in proces method of processor into that method)
don't use a chunk-oriented step for the FTP part, a custom tasklet would be fine.
Thanks i tried Method invoking tasklet amp; passed values through latebinding ( using #{jobExecutionContext['currentRunningJob']} )
it worked as a charm... |
|