Announcement Announcement Module
Collapse
No announcement yet.
SFTP inbound channel adapter and service activation for same file again Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SFTP inbound channel adapter and service activation for same file again

    Hi,

    We have a spring batch based file processing. The spring batch job uses spring integration to fetch the file and
    launch the job. Below are the configuration details.

    HTML Code:
    <bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
    		<property name="host" value="****"/>
    		<property name="port" value="****"/>
    		<property name="user" value="****"/>
    		<property name="password" value="****"/>
    	</bean>
    
    	<int-sftp:inbound-channel-adapter id="InboundChannelAdapter"
     		session-factory="sftpSessionFactory"
    		channel="InChannel"
    		filename-pattern="*.txt"
    		remote-directory="/home/sftp/remote"
    		local-directory="/home/app1/local"
    		delete-remote-files="true"
    		auto-create-local-directory="true"
    		>
    		<int:poller fixed-rate="1000" />
    	</int-sftp:inbound-channel-adapter>
    
    	<int:channel id="InChannel">
    		<int:queue capacity="25"/>
    	</int:channel>
    
    	<int:service-activator  input-channel="InChannel" ref="fileuploadServiceImpl" method="parseFile"/>
    Everything works fine when different files are dropped in sftp location, but if same file dropped again in sftp location,file is copying to local folder( since i am deleting from local after my processing)
    but service is not getting activated, please any body let me know how to activate service for same file again.

    Thanks.

  • #2
    The adapter currently doesn't allow reconfiguration of the default FileListFilter, which is an AcceptOnceFileListFilter - producing the results that you see.

    We have an open JIRA issue to allow configuration of this filter. https://jira.springsource.org/browse/INT-2892

    In the meantime, you could use the outbound gateway to LS and GET the file(s) instead.

    The sample app has some examples; in your case, you'd start the flow with a simple <inbound-channel-adapter/> to generate a request containing the target directory as the payload...

    Code:
    <int:inbound-channel-adapter id="ftpRequestGenerator" expression="'foo/bar'" channel="inbound" >
    	<int:poller fixed-rate="1000" />
    </int:inbound-channel-adapter>
    
    <int-sftp:outbound-gateway id="gatewayLS"
    	session-factory="sftpSessionFactory"
    	request-channel="inbound"
    	command="ls"
    	command-options=""
    	expression="payload"
    	reply-channel="toSplitter"/>
    
    <int:splitter input-channel="toSplitter" output-channel="toGet"/>
    
    <int-sftp:outbound-gateway id="gatewayGET"
    	local-directory="/foo"
    	session-factory="sftpSessionFactory"
    	request-channel="toGet"
    	reply-channel="toLaunchBatch"
    	command="get"
    	command-options="-P"
    	expression="payload.remoteDirectory + payload.filename"/>

    Comment

    Working...
    X