我想存档基于\ name \ date结构的目录中的文件 - 所以即使每天都会更改目录。任何建议都欣赏。
我正在创建一个文件出站网关,其中目录是动态的,其中标头通过生成目录路径的方法进行了丰富。
我在想这样的事情
<file:outbound-gateway id="archive" request-channel="input"
reply-channel="channel" directory="@Header[archiveLocation]}"
mode="REPLACE" delete-source-files="true">
</file:outbound-gateway>
但它似乎不是这样做的方式。
根据以前的相关答案,我对以下的样本很熟悉 https://github.com/spring-projects/spring-integration-samples/blob/master/advanced/dynamic-ftp/src/main/resources/META-INF/spring/integration/dynamic-ftp-outbound-adapter-context.xml
我这样做的顾虑是,如果我需要创建数十个或数百个不同的出站网关,是否会出现任何资源问题?
由于我可以将数据放入标题中,因此有更简单的方法。或者是在上下文初始化时设置的目录字段,并且不能是动态的?
由于
答案 0 :(得分:1)
After finally creating an account on Stack Overflow all these years to post a question, found the answer later. I can use directory-expression.
<file:outbound-gateway id="archive" request-channel="input"
reply-channel="channel" directory-expression="headers.archiveLocation"
mode="REPLACE" delete-source-files="true">
</file:outbound-gateway>