Results 1 to 3 of 3

Thread: Using Spring Integration, can we sort files and then process them?

Hybrid View

  1. #1

    Default Using Spring Integration, can we sort files and then process them?

    A unique requirement for our integration is that we FTP files from a vendor - and then, we need to process them in a specific order (e.g sort by fileName).
    An FTP In-Bound adapter would notify a service activator to process the file, but the order is not guaranteed in this case, and I need to process files in order.

    Is there any way I can accomplish this using a custom filter or selection strategy?

  2. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,853

    Default

    The FileListFilter does return a List, so you should be able to handle sorting there, yes. Give it a shot and let us know if you have any issues.

  3. #3

    Default Tried implementing a simple filter

    That attempts sorting. I also return the file list as sorted.
    [Assume that the files are of .txt extension say 0.txt, 1.txt and so on]
    Custom Filter Input: 0,1,10,2,3.
    Custom Filter Output: 0,1,2,3,10

    However, the service activator's (handleFile) still gets activated for the files
    in sequence 0,1,10,2,3. It appears to ignore the sorted list supplied by my custom filter.

    Also, when my unit test runs, it displays the output for FileReadingMessageSource as Created Message for 0, followed by Created Message for 1, followed by Created Message for 10 and so on.

    Configurations are standard - file inbound adapter with id, directory and filter attribute set. The filter does get invoked and does the sorting. However, the sorted list is ignored by SI, and my service activator gets invoked in the same input order.

    Any help would be appreciated.

    Created a JIRA issue for tracking.
    https://jira.springsource.org/browse/INT-1857
    Last edited by adkathuria@yahoo.com; Apr 4th, 2011 at 06:33 PM.

Tags for this Thread

Posting Permissions

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