0
votes

We have web application and want to use ftp:inbound-channel-adapter to read the files from ftp & create a message & send it to a channel

  1. When local-directory is set to local-directory="#servletContext.getRealPath('')}/temp/inFtp" it gives Message generated is GenericMessage [payload={applicationDeployPath}\temp\inFtp\xyz.stagging.dat, headers={timestamp=1444812027516, id=9b5f1581-bfd2-6690-d4ea-e7398e8ecbd6}]

But directory is not created, i checked i have full permission here. The path [{applicationDeployPath}\temp\inFtp] does not denote a properly accessible directory.

  1. In Message i want to send some more fields as payload having value from property file as per environment, How can I do that?

    <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>
    

thanks in advance

1

1 Answers

0
votes

The local-directory is only evaluated once (and created if necessary), at initialization time, not for every message.

I am surprised the context even initializes; this syntax looks bad:

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

If you mean

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

it would only work if you have some bean called servletContext.

If you mean

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

you would need a variable servletContext in the evaluation context.

it gives Message generated is GenericMessage [payload={applicationDeployPath}\temp\inFtp\xyz.stagging.dat, headers={timestamp=1444812027516, id=9b5f1581-bfd2-6690-d4ea-e7398e8ecbd6}]

If it's actually generating that message, it must have created that directory.

It's not clear what you mean by

I want to send some more fields as payload

The payload is a File.

If you want to change the payload to something else containing the file and other fields, use a transformer.