Results 1 to 6 of 6

Thread: File Support with directory at Runtime

  1. #1

    Default File Support with directory at Runtime

    I want the directory info to pass it to the file outbound gately for writing. Is something liek this possible ? I do not see the file getting written


    <
    Code:
    file:outbound-channel-adapter directory="headers.FILE_ROOT_DIR" 
    	    			channel="fileWriteChannel" filename-generator="customeFIleNmaeGen" auto-create-directory="true"/>

  2. #2
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    Could you please rephrase the question? I am not sure what you are asking. You can get more details about File support from this section of the reference manual http://static.springsource.org/sprin...lsingle/#files
    Also, look at this sample which may help https://github.com/SpringSource/spri...ter/basic/file

  3. #3

    Default

    Hi Oleg I will take a look.
    I will try to re-phase my question. What I want is, to get the directory values using Spel and get the header value (say FILE_DIR) from the message instead of a externalized property file for example. So in my use case I cannot really determine what directory to write until later the request has been placed. For example each client will have root directory + client name as the directory, the file will be written to.
    So what I really need is to construct the directory structure based on the type of request.

  4. #4
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    Like I said go through the sample, make sure it works for you first.
    Since SI 2.1 we have this new attribute as well

    filename-generator-expression which allows you to provide a SpEL expression which will compute the file name of the target file (e.g., assuming payload is java.io.File "payload.name + '.transferred'");

    I think this is what you are looking for

  5. #5

    Default

    I looked into the sample but still did not find my answer. I know about the file name generator. I am using 'filename-generator', but the problem is not with the file name it is the directory name. I do not see a file-directory-generator for example.

    In the sample

    Code:
    <file:outbound-channel-adapter id="filesOut" directory="file:${java.io.tmpdir}/spring-integration-samples/output"/>
    I want the directory part to be constructed using Spel from header values.

  6. #6

    Default

    Used service activator with commons file utils ..., if anyone is interested

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •