0
OUTBOUND GATEWAY가있는 인바운드 채널 어댑터를 사용하여 XML 파일에 beans를 구성했습니다. 자바 클래스에서 @serviceactivator를 사용하여 channel.But m 루트 폴더에있는 파일을 가져 오는 하위 디렉터리에서 파일을 가져올 수 없습니다.다양한 하위 디렉토리에서 FTP 서버의 파일을 반복적으로 다운로드
내 XML 파일 :
<int:inbound-channel-adapter channel="inbound1" expression="'/'">
<int:poller fixed-delay="3000"/>
</int:inbound-channel-adapter>
<int-ftp:outbound-gateway id="gatewayGet"
session-factory="ftpClientFactory"
request-channel="inbound1"
local-directory="C:/Users/pprakash/Desktop/DataFiles/actual"
auto-startup="true"
command="mget"
command-options="-R"
filename-pattern="*.csv"
expression="'actual/*/*'"
reply-channel="outbound"/>
<int:channel id="outbound">
<int:interceptors>
<int:wire-tap channel="logger"/>
</int:interceptors>
</int:channel>
<int:logging-channel-adapter id="logger" log-full-message="true" />
'<bean id="ftpClientFactory"
class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
<property name="host" value="192.168.79.1"/>
<property name="port" value="21"/>
<property name="username" value="*****"/>
<property name="password" value="*****"/>
<property name="bufferSize" value="100000"/>
</bean>'
내 자바 코드 같은 것입니다 : -
static int index=0;
@ServiceActivator(inputChannel = "inbound1")
public void foo1(File file) throws InterruptedException {
logger.debug("Inbound msg to gateway :[ "+(index++)+"]" + file.getAbsolutePath());
}
@ServiceActivator(inputChannel = "outbound")
public void foo2(List<File> file) throws InterruptedException {
System.out.println("outbound gateway");
logger.debug("File Received :[ "+(index++)+"]" + file.size());
}
안녕하세요 gary, 내 하위 디렉토리에 * .csv 파일 ... 하위 디렉토리를 통과하지 못함 ... 하위 디렉토리에없는 파일 만 통과 함 .. /actual/abc/2016/like some * .csv 파일 실제/abc /에 * .csv 파일이 있습니다. 실제/abc/* .csv는 다운로드 중입니다 .. –
오른쪽이지만 디렉토리 자체는 패턴과 일치해야합니다. (regex)'filename-regex = "(actual | abc | * .csv)"와 같은 것입니다. 그렇지 않으면'actual'과'abc'가 필터링됩니다. 또는 디렉토리를 무시 (필터링하지 않음)하는 사용자 정의 'FileListFilter'를 사용할 수 있습니다. 프레임 워크에 이러한 필터를 추가해야합니다. [JIRA Issue] (https://jira.spring.io/browse/INT-4149)를 추가했습니다. –
예, 파일 - 패턴을 무시한 후 모든 하위 디렉토리의 각 파일을 다운로드 중입니다. 감사합니다. 게리 .csv 파일 만 다운로드하면 되나요? 서버가 작동 중일 때 새 파일을이 하위 디렉토리에 넣으면 그 파일도 다운로드 할 수 있습니까? –