user509755
user509755

Reputation: 2981

spring integration outbound sftp channel adapter file delivery confirmation

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.

Upvotes: 2

Views: 338

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121177

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.

Upvotes: 1

Related Questions