Results 1 to 4 of 4

Thread: Dynamically changing local file directory in ftp:outbound gateway

  1. #1
    Join Date
    May 2011
    Location
    Mumbai, India
    Posts
    93

    Question Dynamically changing local file directory in ftp:outbound gateway

    Hi,

    Can we dynamically change the local file directory path in an ftp-outbound gateway?

    I have an abstract class, which is extended by multiple classes.
    I want to update the local file directory path for each of these classes?
    Tried changing the value in the code too, but it is not reflecting in the ftp-outboundgateway.
    Below is my ftp outbound gateway config.

    Code:
    <int-ftp:outbound-gateway command="get"
    		expression="payload" session-factory="ftpClientFactory" local-directory="#{ T(com.ftp.inboundtest.FTPService).LOCAL_FTP_TEMP_DIR}" filename-pattern="*.csv"
    		request-channel="ftpgetChannel" />
    Here com.ftp.inboundtest.FTPService is an abstract class, which is implemented by multiple classes.

    Please help.

    Thanks in advance.
    Regards,
    Annuk

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

    Default

    Well, we have this feature for the remote directories via remote-directory-expression attribute, but I wonder why would you even care for this directory to be dynamic? The reason why I am asking is because this local-directory identifies a temporary place to which files are going to be synchronized from the remote server so they can be sent further downstream, so I am looking at it as a temporary place.

    I am still open for creating local-directory-expression attribute, but want to better understand the use case.

  3. #3
    Join Date
    May 2011
    Location
    Mumbai, India
    Posts
    93

    Question

    Hey Oleg,

    Thanks for your reply.

    I want local directory to be dynamic.
    I want to use the same gateway configuration for different types of entities else i would need to create n number of gateways for n number of entities.

    While doing LS, for different type of entities, there is different remote location.
    Say my entities are SPORTS, POLITICS.

    I want different local directories for this entities. I need to code just once.

    My ftp config is:
    Code:
    <int:channel id="ftpLsChannel" />
    	<int:channel id="ftpGetChannel" />
    
    	<int:gateway id="ftpLsGateway"
    		default-request-channel="ftpLsChannel"
    		service-interface="com.server.ftp.LSFTPGateway" />
    
    	<int:gateway id="ftpGetGateway"
    		default-request-channel="ftpGetChannel"
    		service-interface="com.server.ftp.GETFTPGateway" />
    
    	<int-ftp:outbound-gateway command="ls"
    		expression="payload" session-factory="ftpClientFactory"
    		request-channel="ftpLsChannel" />
    
    	<int-ftp:outbound-gateway command="get" id="getOutbound"
    		expression="payload" session-factory="ftpClientFactory"
    		local-directory="/home/anwaar/Desktop/csvs"
    		filename-pattern="*.csv" request-channel="ftpGetChannel" />
    
    	<bean id="ftpClientFactory"
    		class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
    		<property name="host" value="test" />
    		<property name="port" value="21" />
    		<property name="username" value="test" />
    		<property name="password" value="testing" />
    	</bean>
    I have an abstract class in which I call these ftp outbound gateways which has a variable for LOCAL_FILE_LOCATION.

    Please help. Else I would be copying all the files in one local file directory only.

    Regards,

    Annuk

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

    Default

    Please rais a JIRA and we'll see what we can do
    Thanks

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
  •