We are using sftp channel adapter to send files to sftp server. Is there any way to confirm whether file is delivered or not? What we are facing is sometime a dropped connection between our server and sftp server and we like to know and retry if file transfer was not successfull.
2
votes
1 Answers
1
votes
Actually everything in the FileTransferringMessageHandler
is done sequentially.
So, I'm sure you are facing one of the exceptions in your logs:
catch (FileNotFoundException e) {
throw new MessageDeliveryException(message, "File [" + inputStreamHolder.getName()
+ "] not found in local working directory; it was moved or deleted unexpectedly.", e);
}
catch (IOException e) {
throw new MessageDeliveryException(message, "Failed to transfer file ["
+ inputStreamHolder.getName() + " -> " + fileName
+ "] from local directory to remote directory.", e);
}
catch (Exception e) {
throw new MessageDeliveryException(message, "Error handling message for file ["
+ inputStreamHolder.getName() + " -> " + fileName + "]", e);
}
The <int-sftp:outbound-channel-adapter>
supports <request-handler-advice-chain>
, where one of them can be <retry-advice>
(or MessageHandlerRetryAdvice
bean reference) to meet your requirements.
Please, find more info in the Reference Manual.