4 Replies Latest reply on Oct 25, 2009 9:20 PM by guillaume.bardy

    Multiple dynamic file poller instances

    guillaume.bardy

      Hi,

       

      My need is the following: at runtime I will need to polle several files. These files, their numbers and their paths are "permanently" changing during runtime. My issue is that I have no idea how I can do that with file pollers.

      My current guess is that I could dynamically instantiate a generic SA (pollig files) during runtime, when I need it and configure the path of the file. But I cannot see how to actually implement this kind of thing.

      Did anyone have this kind of requirement? Any wild guess on how to implement this with FUSE ESB?

       

      Thanks a lot.

        • 1. Re: Multiple dynamic file poller instances
          joe.luo

          Once a file poller endpoint is initialized, you can not change target directory that the file poller will poll the files from.

           

          Have you tried with "filter" properties of the file poller to selectively poll files from designated directory based on filter criteria?

          http://servicemix.apache.org/servicemix-file.html

          • 2. Re: Multiple dynamic file poller instances
            guillaume.bardy

            Thanks, that's actually an idea.

             

            It depends on how "powerful" this filter is. To be specific in my case, i am waiting for a xml file to be deleted (in a subdirectory sub1) to poll another xml file (in a subdirectory sub2).

            I have plenty (and the number is dynamic at runtime) of these subdirectories like this:

             

            root

                

            • dir1

                   *subdir1

                   *subdir2

                 

            • dir2

                   *subdir1

                   *subdir2

             

            I think if the filter allows me to put a condition (like no xml in subdir1) and this name in subdir2 with relative path it should be alright.

            Is that possible?

            • 3. Re: Multiple dynamic file poller instances
              davsclaus

              You can implement you own class that implements the java.io.FileFilter where you can determine which files to include or not.

               

              As you get hold of the java.io.File object you have all the information about absolute paths, name, parent directory etc.

              • 4. Re: Multiple dynamic file poller instances
                guillaume.bardy

                So you are advising to create a POJO implementing the logic I need. It is definately a possibility, but I was looking for a more "standard way" of doing things... re-use existing components.