2017-04-13 47 views
1

與SI XML分配ID整合入站適配器很簡單,如下是有可能分配一個bean的id春季DSL

<int-ftp:inbound-channel-adapter id="ftpInbound" 
     channel="ftpChannel" session-factory="ftpClientFactory" 
     filename-pattern="*.txt" auto-create-local-directory="true" 
     delete-remote-files="false" remote-directory="${remotedir}" 
     local-directory="/apps/wfg/ftp/test" auto-startup="true"> 
     <int:poller fixed-rate="1000"> 
      <int:transactional synchronization-factory="syncFactory" /> 
     </int:poller> 
    </int-ftp:inbound-channel-adapter> 

能同在DSL代碼來完成,以及下面?

IntegrationFlow flow = IntegrationFlows 
     .from(Ftp 
      .inboundAdapter(csf) 
      .preserveTimestamp(true) 
      .remoteDirectory(feed.getRemoteDirectory()) 
      .regexFilter(feed.getRegexFilter()) 
      .deleteRemoteFiles(feed.getDeleteRemoteFiles()) 
      .autoCreateLocalDirectory(
       feed.getAutoCreateLocalDirectory()) 
      .localFilenameExpression(
       feed.getLocalFilenameExpression()).get(); 

也可以在這種情況下完成相同的過渡同步。

回答

1
IntegrationFlow flow = IntegrationFlows.from(Ftp.inboundAdapter(sessionFactory()) 
       .preserveTimestamp(true) 
       .remoteDirectory("ftpSource") 
       .regexFilter(".*\\.txt$") 
       .localFilename(f -> f.toUpperCase() + ".a") 
       .localDirectory(getTargetLocalDirectory()), 
     e -> e.id("ftpInboundAdapter") 
       .poller(Pollers.fixedDelay(100) 
        .transactionSynchronizationFactory(syncFactory()))) 
     .channel(out) 
     .get(); 
+0

感謝@ gary-russell爲此。看起來是我的IDE內容協助問題(無法獲取API函數)我問這個愚蠢的問題,在發佈之前會查看消費者規範。 –