Announcement Announcement Module
Collapse
No announcement yet.
SFTP inbound channel adapter in cluster Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SFTP inbound channel adapter in cluster

    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 deployed on a single tomcat server. We tried to deploy the application in two tomcat instances on different machines. When a file was dropped in the sftp location, both the applications deployed in the tomcat servers picked up the file. How do we ensure that only one tomcat instance picks up the file for processing? The size of the file was around 5 MB.

  • #2
    response to above post is highly helpful, please respond anybody

    Comment


    • #3
      The only way to avoid this is to have only one instance active - set auto-startup="false" on the adapter and use management software (JMX) to start/stop the adapter on just one instance (and monitor the instance so you can start another if the current active instance goes down).

      You can even use another Spring Integration application to monitor/control if you don't have enterprise management software. See the monitoring sample for examples: https://github.com/garyrussell/sprin...ate/monitoring

      Comment

      Working...
      X