How to add custom method to spring integration ftp gateway interface? -
following spring integration ftp doc , have managed send files ftp server through java config way:
@messaginggateway public interface mygateway { @gateway(requestchannel = "toftpchannel") void sendtoftp(file file); }
ss
public static void main(string[] args) { configurableapplicationcontext context = new springapplicationbuilder(ftpjavaapplication.class) .web(false) .run(args); mygateway gateway = context.getbean(mygateway.class); // sending file ftp server gateway.sendtoftp(new file("/foo/bar.txt")); }
it seems me code above using custom method 'sendtoftp()' send file target ftp server. question how add other methods mygateway interface implement operations?
ls (list files) (retrieve file) mget (retrieve file(s)) rm (remove file(s)) mv (move/rename file) put (send file) mput (send multiple files)
each ftp gateway can handle 1 method.
you need declare 1 each, then...
@messaginggateway public interface mygateway { @gateway(requestchannel = "toftpgetchannel") void sendtoftpget(...); @gateway(requestchannel = "toftpputchannel") void sendtoftpput(...); ... }
Comments
Post a Comment