Camel SFTP配置疑问:delete=true与disconnect=true兼容性及异常排查
Let’s tackle your two questions one by one, based on how Camel SFTP handles these settings:
1. Can delete=true be used with disconnect=true?
Absolutely—these two configurations work perfectly together, as they govern separate parts of the SFTP component's behavior:
delete=trueinstructs Camel to delete the source SFTP file after your route finishes processing itdisconnect=truetells Camel to close the SFTP connection immediately after transferring the file to your local processing step (not after processing completes)
There’s no inherent conflict between them; they just handle different stages of the file workflow.
2. Will disconnect=true fix the "pipe closed" delete error?
Let’s break down what’s happening and how this setting helps:
- When you don’t use
disconnect=true, Camel keeps the SFTP connection open during your 40-minute processing window. Most SFTP servers will drop idle connections after a shorter timeout (often 15-30 minutes), which is why you’re getting thatGenericFileOperationFailedExceptionwhen Camel tries to delete the file later. - With
disconnect=true, Camel closes the connection right after it pulls the file down for processing. When your route finishes and needs to delete the source file, Camel will automatically re-establish a fresh SFTP connection to perform the delete operation. This avoids relying on an idle connection that’s already been closed by the server.
This should resolve your pipe closed error, as Camel won’t hold onto a stale connection during the long processing period. If you still run into issues, you might also want to check if your SFTP server allows adjusting connection timeout settings, but disconnect=true is the primary fix here.
内容的提问来源于stack exchange,提问作者Ronak Patel

