ftp 서버에서 파일을 다운로드하려고 할 때 몇 가지 문제가 있습니다. 다운로드 한 파일을 빈 폴더에 저장하려고하면 모든 것이 완벽하게 작동하지만 폴더에 다른 파일이 포함되어 있으면 코드가 서버에 연결조차되지 않습니다.스프링 통합을 사용하여 파일 다운로드
<bean id="ftpClientFactory"
class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
<property name="host" value="${host}"/>
<property name="username" value="${user}"/>
<property name="password" value="${password}"/>
<property name="clientMode" value="0"/>
<property name="fileType" value="2"/>
<property name="bufferSize" value="10000000"/>
</bean>
<int:channel id="getFtpChannel">
<int:queue/>
</int:channel>
<int-ftp:inbound-channel-adapter local-directory="ftp/"
channel="getFtpChannel"
session-factory="ftpClientFactory"
remote-directory="./"
auto-create-local-directory="false"
delete-remote-files="true"
filename-pattern="*.exi">
<int:poller fixed-rate="10000"/>
</int-ftp:inbound-channel-adapter>
그리고 내 자바 코드 : 여기 내 컨텍스트 파일의
public void receiveTest() {
ConfigurableApplicationContext context =
new FileSystemXmlApplicationContext("/src/citrus/resources/citrus-context.xml");
PollableChannel channel = context.getBean("getFtpChannel", PollableChannel.class);
channel.receive();
context.close();
}
테스트가 통과하고 모든 작업처럼 보이지만하지 않습니다. 잘못된 아이디어가 있습니까? 미리 감사드립니다.
로컬 디렉토리 'ftp /'가 비어 있지 않으면 FTP에서 파일을 다운로드하지 않는다는 뜻입니까? 나쁜 케이스에 대한'org.springframework.integration' 카테고리에 대한 DEBUG 로그를 보여주십시오. –
네, 바로 그 뜻입니다. 나는 그 로그를 얻으려고 노력할 것이고, 그 다음에 나의 포스트를 편집 할 것이다. – mlethys