Results 1 to 3 of 3

Thread: SFTP inbound channel adapter in cluster

  1. #1

    Default 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. #2

    Default

    response to above post is highly helpful, please respond anybody

  3. #3
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,037

    Default

    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
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

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
  •