File 在Mule中将文件从一个位置移动到另一个位置
我对骡子不熟悉。我必须完成以下任务 文件位于某个位置。我需要把那个文件移到其他地方。选择位置的条件基于文件名 假设文件名为File 在Mule中将文件从一个位置移动到另一个位置,file,mule,mule-studio,File,Mule,Mule Studio,我对骡子不熟悉。我必须完成以下任务 文件位于某个位置。我需要把那个文件移到其他地方。选择位置的条件基于文件名 假设文件名为'abc\u loc1'。然后将此文件移动到文件夹位置1。如果文件名为'abc_loc2',则应将其移动到位置2您可以使用具有入站和出站端点的Mule来移动文件,并为出站设置动态路径属性,或基于原始文件名使用。原始文件名为#[message.inboundProperties.originalFilename] 更新(示例流): 更新2: 要使用选择路由,请将上述文件出站
'abc\u loc1'
。然后将此文件移动到文件夹位置1。如果文件名为'abc_loc2'
,则应将其移动到位置2您可以使用具有入站和出站端点的Mule来移动文件,并为出站设置动态路径属性,或基于原始文件名使用。原始文件名为#[message.inboundProperties.originalFilename]
更新(示例流):
更新2:
要使用选择路由,请将上述文件出站替换为以下内容:
<choice>
<when expression="#[flowVars['myPath'] == '1']">
<file:outbound-endpoint path="/tmp/1" responseTimeout="10000" connector-ref="File" outputPattern="error#[message.inboundProperties['originalFilename']]"/>
</when>
<when expression="#[flowVars['myPath'] == '2']">
<file:outbound-endpoint path="/tmp/2" responseTimeout="10000" connector-ref="File" outputPattern="error#[message.inboundProperties['originalFilename']]"/>
</when>
</choice>
您可以共享配置xml文件吗?添加了一个简单的示例,大致符合您的描述。谢谢Anton,实际上我的文件名不包含位置,它只提示文件应放在哪个位置。例如,如果文件名为abc_loc1,则loc1不是实际的文件夹,它只是位置的标识符。像loc1一样,可以告诉我文件夹位置是“/tmp/data”等等。使用“路由选择”选项再次更新我的帖子
<choice>
<when expression="#[flowVars['myPath'] == '1']">
<file:outbound-endpoint path="/tmp/1" responseTimeout="10000" connector-ref="File" outputPattern="error#[message.inboundProperties['originalFilename']]"/>
</when>
<when expression="#[flowVars['myPath'] == '2']">
<file:outbound-endpoint path="/tmp/2" responseTimeout="10000" connector-ref="File" outputPattern="error#[message.inboundProperties['originalFilename']]"/>
</when>
</choice>