Announcement Announcement Module
Collapse
No announcement yet.
Dynamically changing local file directory in ftp:outbound gateway Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Comment


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

      Comment


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

        Comment

        Working...
        X