Announcement Announcement Module
Collapse
No announcement yet.
Sorting order issue for SFTP inbound adapter Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Comment


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

      Comment


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

        Comment


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

          Comment


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

            Comment


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

              Comment


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

                Comment

                Working...
                X