2015-10-14 96 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

    相关问题