2015-09-01 34 views
1

我想歸檔基於\ 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

我做這種方式是值得關注,會有任何資源問題,如果我需要創建幾十或數百個不同出站網關?

因爲我可以把數據放在標題中,有沒有更簡單的方法來做到這一點。或者是在上下文初始化時設置的目錄字段,並且不能是動態的?

感謝

回答

1

終於在堆棧溢出創建一個帳戶這些年來發布問題後,找到了答案以後。我可以使用目錄表達式。

<file:outbound-gateway id="archive" request-channel="input" 
reply-channel="channel" directory-expression="headers.archiveLocation" 
mode="REPLACE" delete-source-files="true"> 
</file:outbound-gateway>