Results 1 to 8 of 8

Thread: Sorting order issue for SFTP inbound adapter

  1. #1
    Join Date
    Mar 2010
    Posts
    18

    Default Sorting order issue for SFTP inbound adapter

    I have a the following (ordinary) sftp inpbound adapter definition:
    Code:
    <int-sftp:inbound-channel-adapter
    	local-directory="${sftp.localDir}" channel="sdml.in" session-factory="cachedSftpSessionFactory"
    	remote-directory="${sftp.remoteDir}" delete-remote-files="true"
    	filter="compositFilter">
    	<int:poller fixed-rate="${sftp.pollingRate}"
    		max-messages-per-poll="-1" task-executor="pool">
    		<int:advice-chain>
    			<ref bean="sysStateInspectingInterceptor" />
    		</int:advice-chain>
    	</int:poller>
    </int-sftp:inbound-channel-adapter>
    Here I used a composite filter, where one of the filter's goal is to sorts the files in a business-specific order. Expected behaviour for the xml declaration above is that it should download and forward the eligible files in sorted order (expressed in terms of the filter-logic).
    I find that this is not the case; filtering is ok, download order is still ok, but Messages generated by the adapter are inordered!
    Looking at the source I've found the following:
    SFTP message source - and generally all MessageSource<File> implementation extending AbstractInboundFileSynchronizingMessageSource must exhibit this behaviour. I guess the reason is that AbstractInboundFileSynchronizingMessageSource instantiates a FileReadingmessageSource in order to handle the downloaded files.
    I - as an SI user - dont have any possibilities to configure this fileSource instance! This is the couse of the problem.
    Regarding this issue https://jira.springsource.org/browse/INT-1857, processing order of a FileReadingMessageSource can be influenced by a Comparator<File> of the queue, what can be nicely configured via a <int-file:inbound-channel-adapter> (as a comparator attribute), but not in a <int-sftp:inbound-channel-adapter>!
    Please give me some hints, workaround, how could i achive ordered processing of the downloaded files?
    thanks,
    Gabor

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

    Default

    Gabor

    I'll try to address INT-1857 today, so you should be able to get it from the nightly tomorrow. I'll let you know.

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

    Default

    Also, could you please open a separate JIRA for adding 'comparator' attribute on FTP/SFTP adapters?

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

    Default

    Sorry, weren't looking. INT-1857 is addressed, but not for FTP/SFTP and hat is what we are trying to fix

  5. #5
    Join Date
    Mar 2010
    Posts
    18

    Default

    Opened an issue for it: INT-1901
    Thanks!
    Gabor

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

    Default

    Gabor, I just pushed the change. So now you can configure comparator on both FTP and SFTP the same way you do for file. Give it a shot and let me know.
    Cheers

  7. #7
    Join Date
    Mar 2010
    Posts
    18

    Default

    Oleg, thanks for your quick work! I have some other issues, but I'll back soon and will test the change!
    thx,
    Gabor

  8. #8
    Join Date
    Mar 2010
    Posts
    18

    Default

    You did a great job, Oleg, it works pretty fine, orders files as expected!
    Thank you!

Posting Permissions

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