I have a requirement is to read file from a FTP remote directory insert payload values into database and then move file from remote directory /in to remote directory /archive of same FTP server.
I am using spring integration @InboundChannelAdapter and able to invoke ExpressionEvaluatingTransactionSynchronizationProcessor setAfterCommitExpression. I am struggling to find a way to construct a spel parse expression to move from inbound remote directory to another.
The
setAfterCommitExpressionis executed againstMessageas a root object. That message is exactly whatFtpInboundFileSynchronizingMessageSourceis producing. The payload of this message is anFTPFile. There are also some additional headers:So, you may call some service from that expression like
@myFtpMoveService.moveRemoteFile(#root)and accept in that method aMessagewith all the info you needed to determine the remote file, its name and directory.