2015-10-14 95 views
0

我們的Web應用程序,並希望使用ftp:入站通道適配器讀取從FTP &文件創建一個消息&其發送到通道入站通道適配器的本地目錄和信息

  1. 本地目錄設置爲local-directory =「#servletContext.getRealPath('')}/temp/inFtp」時,它給出 生成的消息是 GenericMessage [payload = {applicationDeployPath} \ temp \ inFtp \ xyz。 stagging.dat,headers = {timestamp = 1444812027516,id = 9b5f1581-bfd2-6690-d4ea-e7398e8ecbd6}]

但目錄沒有創建,我檢查我有充分的權限在這裏。 路徑[{applicationDeployPath} \ temp \ inFtp] 不表示可正確訪問的目錄。

  • 在Message我想發送一些更多的字段爲具有從屬性文件按環境值的有效載荷,如何做呢?

    <int-ftp:inbound-channel-adapter id="ftpInboundAdaptor" 
        channel="ftpInboundChannel" 
        session-factory="ftpClientFactory" 
        filename-pattern="*.stagging.dat" 
        delete-remote-files="false" 
        remote-directory="/stagging/" 
        local-directory="#servletContext.getRealPath('')}/temp/inFtp" 
        auto-create-local-directory="true"> 
        <int:poller fixed-rate="1000"/> 
    </int-ftp:inbound-channel-adapter> 
    
  • 由於事先

    回答

    0

    local-directory只計算一次(並且如果需要創建的),在初始化時,不爲每個消息。

    我很驚訝上下文甚至初始化;這句法不妙:

    local-directory="#servletContext.getRealPath('')}/temp/inFtp" 
    

    如果你的意思

    local-directory="#{servletContext.getRealPath('')}/temp/inFtp" 
    

    如果你有一些豆稱爲servletContext它只會工作。

    如果你的意思

    local-directory="#servletContext.getRealPath('')/temp/inFtp" 
    

    你需要在評估方面的變量servletContext

    它給產生的消息是GenericMessage [有效載荷= {applicationDeployPath} \ TEMP \ inFtp \ xyz.stagging.dat,標頭= {時間戳= 1444812027516,ID = 9b5f1581-bfd2-6690-d4ea-e7398e8ecbd6}]

    如果它實際上是生成該消息,它必須創建該目錄。

    目前尚不清楚你的意思是由

    我想送一些領域的有效載荷

    有效載荷是File

    如果您想將有效負載更改爲包含文件和其他字段的其他內容,請使用變壓器。

    +0

    謝謝加里,爲了在消息有效載荷中添加額外的信息,我將使用變壓器。 這是撰寫問題時的錯字。真正的配置是 'local-directory =「#{servletContext.getRealPath('')}/temp/inFtp」' 正如您所提到的那樣。並且該文件夾被創建並且文件被按預期複製,但由於它是共享臨時空間,因此它被另一個進程清除。 – ManishSingh

    相關問題