spring integration - sftp:outbound-gateway moving file not working -


i new spring-integration. request me issue.

i using sftp:outbound-gateway move file 1 folder folder.

folder structure is:

top-dir - module-dir     - output-dir         filexyz.txt     - archive-dir 

i want move filexyz.txt output archive folder.

configuration is:

<int-sftp:outbound-gateway  session-factory="ftpsessionfactory" expression="payload.remotedirectory + '/' + payload.filename" request-channel="inchannel" command="mv" rename-expression="payload.remotedirectory + '/' +       payload.filename.replacefirst('output-dir','archive-dir')" reply-channel="outchannel"/> 

java code:

 directchannel movechannel = context.getbean("inchannel",directchannel.class);  movechannel.send(new genericmessage<file>(new file("top-dir\module-dir\output-dir\filexyz.txt"))); 

i referred issue @ how replace string in spel expression? not solve problem.

i getting expression evaluation failed: payload.remotedirectory + '/' + payload.filename exception.

i think doing wrong in java code.

please me.

expression="payload.remotedirectory + '/' + payload.filename"

your payload simple java.io.file; not have properties.

you need use absolute path; like

expression="payload.absolutepath

and

rename-expression="payload.absolutepath.replace....

if running on windows might need replace \ / too.

to use existing expressions, need custom payload instead of file, remotedirectory , filename properties.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -