Announcement Announcement Module
Collapse
No announcement yet.
File Support with directory at Runtime Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Comment


    • #3
      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.

      Comment


      • #4
        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

        Comment


        • #5
          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.

          Comment


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

            Comment

            Working...
            X