首页 > 解决方案 > 在骆驼路线中当 move=null 时会发生什么?

问题描述

在我的 Spring Camel 应用程序中,我尝试基于destinationFolder属性移动或删除文件。如果destinationFolder=null,我希望删除该文件。如果destinationFolder!=null,我希望将文件移动到destinationFolder.

String destinationFolder;

//In the Camel routeBuilder:
from("file://C:/folder1?move=" + destinationFolder)

destinationFolder 为空会发生什么?文件是否移动到默认位置?

当我设置destinationFolder=null 时,我看到文件夹1 中的文件已被删除。

标签: springapache-camel

解决方案


如果您设置了移动选项,那么文件组件将移动文件,您不能将其设置为null然后让它自动删除文件。默认情况下,该文件被移动到名为.camel.

所以要么设置 delete=true 要么设置移动到某个文件夹名称来移动文件。


推荐阅读