3

チャネルが作成された後、チャネルの FTP ディレクトリを変更できるようにしたいと考えています。私たちの特定の使用例では、FTP プットのサブディレクトリは実行時に決定されます。例:test/reports/27-11-2012/abc.pdfなどtest/reports/28-11-2012/abc.pdf

このようなもの

<int-ftp:outbound-channel-adapter id="ftpOutbound" channel="ftpChannel" remote-directory="remoteDirectoryPath" 
   session-factory="ftpClientFactory" />

remoteDirectoryPath - ランタイムを追加する必要があります

誰でも解決策を教えてください。

4

2 に答える 2

1

使用するremote-directory-expression

@ beanName.method()は現在、この式では使用できません。ディレクトリの生成にはSpELを使用する必要があります...

"'test' + T(java.io.File).separator + new java.text.SimpleDateFormat('yyyyMMDD').format(new java.util.Date())"
于 2012-11-27T13:31:24.443 に答える
1

実行時にディレクトリ/パスを ftp:outbound-channel-adapter に割り当てることができます。ここでデータを処理しています。これを確認できます。これは私のために働いています。

xml 側:

<int-ftp:outbound-channel-adapter id="ftpOutboundAdapter" session-factory="ftpSessionFactory"
    channel="sftpOutboundChannel"
    remote-directory-expression="@targetDir.get()"
    remote-filename-generator="fileNameGenerator"/>

<bean id="targetDir" class="java.util.concurrent.atomic.AtomicReference">
    <constructor-arg value="D:\PATH\"/>
</bean>

このブロックでは...remote-directory-expression="@targetDir.get()" 実行時にディレクトリ/パスを設定するために使用されます。

Java 側:

AtomicReference<String> targetDir = (AtomicReference<String>)appContext.getBean("targetDir", AtomicReference.class);
    targetDir.set("E:\PATH\");

これにより、パスを設定できます。

于 2015-12-10T13:10:20.323 に答える