Spring integration DSL creating Sftp OutBound Adapter in java 1.7 -
i have created sftp outbound flow in spring dsl have created 1 more file inbound flow on top of sftp outbound flow files local directory , send message channel responsible copying file remote directory when running code no file getting copied in remote directory. getting stuck in point, can 1 please provide pointer not able proceed.
this session factory...
@autowired private defaultsftpsessionfactory sftpsessionfactory; @bean public defaultsftpsessionfactory sftpsessionfactory() { defaultsftpsessionfactory factory = new defaultsftpsessionfactory( true); factory.sethost("111.11.12.143"); factory.setport(22); factory.setuser("sftp"); factory.setpassword("*******"); return factory; }
this sftp outbound flow..
@bean public integrationflow sftpoutboundflow() { return integrationflows .from("tosftpchannel") .handle(sftp.outboundadapter(this.sftpsessionfactory) .remotefileseparator("\\") .usetemporaryfilename(false) .remotedirectory(remdir)).get(); }
this file inbound flow..
@bean public integrationflow filereadingflow() { return integrationflows .from(filemessagesource(), new consumer<sourcepollingchanneladapterspec>() { @override public void accept(sourcepollingchanneladapterspec e) { e.poller(pollers.fixedrate(6)); } }) .transform(transformers.filetobytearray()) .channel(messagechannels.queue("filereadingresultchannel")) .get(); }
this messagesource method.......
@bean public messagesource<file> filemessagesource() { filereadingmessagesource source = new filereadingmessagesource(); source.setdirectory(new file(localdir)); source.setautocreatedirectory(true); system.out.println("enter filemessagesource....."+ source.receive()); return source; }
this junit test method...
@autowired private defaultsftpsessionfactory sftpsessionfactory; @autowired @qualifier("tosftpchannel") private messagechannel tosftpchannel; @autowired @qualifier("filereadingresultchannel") private pollablechannel filereadingresultchannel; @test public void testsftpoutboundflow() { message<?> message = ((pollablechannel) filereadingresultchannel) .receive(600); system.out.println("message....."+message); this.tosftpchannel.send(message); }
the system.out.println("enter filemessagesource....."+ source.receive());
bad in filemessagesource()
@bean
, because there source.receive()
. isn't responsibility of sout
that.
from other side better if you'd share stacktrace on matter...
and 1 more point: see in console result of system.out.println("message....."+message);
?
Comments
Post a Comment