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.
I created a Messaging Gateway
@MessagingGateway
public interface FtpGateway {
@Gateway(requestChannel = "ftpChannel")
void sendFile(File file);
}
and @ServiceActivator
@Bean
@ServiceActivator(inputChannel = "ftpChannel")
public MessageHandler ftpFileTransferMessageHandler() {
// MessageHandler config..
}
and provided @Gateway method "@ftpGateway.sendFileToArchive(payload)")
as SPEL to the setAfterCommitExpression in TransactionSynchronizationFactory
spelParser.parseExpression("@ftpGateway.sendFileToArchive(payload)"));