0
是否有機會在java代碼內更改/設置入站通道適配器的某些屬性值? 我需要從ftp服務器下載特定的文件。在運行應用程序之前我不知道哪個文件,所以我必須動態設置filename-pattern
。 我發現有一個關於這個問題,但沒有正確答案,所以我再次問。 這是我的inbound-channel-adapter
配置:使用java代碼動態設置ftp的屬性:入站通道適配器
<int-ftp:inbound-channel-adapter local-directory="ftp"
channel="getFtpChannel"
session-factory="ftpClientFactory"
charset="UTF-8"
remote-directory="${remote-download-directory}"
remote-file-separator="/"
auto-create-local-directory="true"
delete-remote-files="false"
filename-pattern="">
<int:poller fixed-rate="10000"/>
</int-ftp:inbound-channel-adapter>
我想設置/更改filename-pattern
。 這是我的代碼,根據這個屬性,但只有當我把它在我的配置接收文件:
ConfigurableApplicationContext context =
new FileSystemXmlApplicationContext("/src/citrus/resources/citrus-context.xml");
PollableChannel channel =
context.getBean("getFtpChannel", PollableChannel.class);
channel.receive();
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
fail(e.getMessage());
}
context.close();
我知道,我所要求的A L ot,但你能給我一些提示,我該怎麼做?我必須實現'boolean accept()'。我應該通過'消息>'對象這個方法?和(如果是的話)我怎樣才能訪問它的模式? – mlethys
增加了一些潛在的實現。 –
經過一些修改後,它可以很好地工作。非常感謝! – mlethys