ftp - how to write output channel from itemWriter in spring batch and spring integration? -


firstly attention, combined spring batch , spring integration, defined job flow , retrieve files ftp adapter , sent jobchannel, , process on spring batch , want write output channel , consume channel after processing, code is:

     <int-ftp:outbound-gateway id="gatewayget"                                   local-directory-expression="'./backup/' +#remotedirectory"                                   session-factory="ftpsessionfactory"                                   request-channel="togetchannel"                                   reply-channel="toprocesschannel"                                   command="get"                                   temporary-file-suffix=".writing"                                   command-options="-p"                                   expression="payload.remotedirectory + '/' + payload.filename"/>         <int:channel id="toprocesschannel">             <int:interceptors>                 <int:wire-tap channel="logger2"/>             </int:interceptors>         </int:channel>     <int:channel id="outboundjobrequestchannel"/>     <int:channel id="replyjobchannel"/>    <service-activator input-channel="joblaunchreplychannel"/>  <int:transformer input-channel="toprocesschannel" output-channel="outboundjobrequestchannel">         <bean class="ir.isc.macna.configuration.filemessagetojobrequest">             <property name="fileparametername" value="filename"/>         </bean>     </int:transformer>     <batch-int:job-launching-gateway request-channel="outboundjobrequestchannel"                                      reply-channel="joblaunchreplychannel"/> 

and writer code is:

@component @stepscope public class macnafilewriter implements chunkmessagechannelitemwriter<fileinfo> {      @autowired     @qualifier("replyjobchannel")     private messagechannel messagechannel;     @override     public void write(list<? extends fileinfo> list) throws exception {         // send message replyjobchannel channel send method     } } 

and use ftp adapter write files on server:

<int-ftp:outbound-gateway session-factory="ftpsessionfactory"                               request-channel="replyjob"                               command="mput"                               auto-create-directory="true"                               expression="payload"                               remote-directory-expression="payload.remotedirectory + '/' + payload.filename + '.out'"                               reply-channel="output"/> 

is standard way run batch job , consume result?

messagechannel has send method. purpose can use messagebuilder create message<?> payload.

since <channel> there no difference other messagechannel consume. standard way define consumer this:

<service-activator input-channel="joblaunchreplychannel"/> 

however isn't clear why going send messages joblaunchreplychannel, when channel specific result <batch-int:job-launching-gateway> (joblaunchinggateway class):

jobexecution = this.joblaunchingmessagehandler.launch(joblaunchrequest); 

so, jobexecution sent joblaunchreplychannel.

see spring batch integration documentation.

maybe need asyncitemwriter or chunkmessagechannelitemwriter?


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -