스프링 통합에서 파일 어댑터와 관련된 몇 가지 문제가 있었으며 전에는 들어 본 적이 전혀 없었습니다. 아래 코드를 사용하여 FTP 폴더에서 파일을 읽고 로컬 디렉토리에 씁니다.스프링 통합 - 첫 번째 시도 후 파일 어댑터가 작동하지 않습니다.
문제는 서버를 시작한 후에 처음으로 문제가되지 않습니다. 그러나 후속 호출은 파일 어댑터를 호출하지만 파일 이동 프로세스는 일어나지 않습니다.
크론 타이밍 : 0/20 * * * *?
이상한 행동에 대해 알고 싶습니다.
<int:channel id="txtFilesIn">
<int:dispatcher task-executor="executor"/>
</int:channel>
<int:channel id="txtFilesOut">
<int:dispatcher task-executor="executor"/>
</int:channel>
<int-file:inbound-channel-adapter id="txtFilesIn"
directory="${FILE_IN}"
filename-pattern="*.csv"
auto-startup="true">
<int:poller cron="${CRON_TAB}" ></int:poller>
</int-file:inbound-channel-adapter>
<int:service-activator input-channel="txtFilesIn"
output-channel="txtFilesOut"
ref="apiCommonService"
method="readFile"/>
<int-file:outbound-channel-adapter id="txtFilesOut"
directory="${FILE_OUT}"
delete-source-files="true"/>
편집 1 :
그것은 지금 잘 작동이
<int-file:inbound-channel-adapter id="txtFilesIn"
directory="${FILE_IN}"
auto-startup="true"
local-filter="acceptAll">
<int:poller cron="${CRON_TAB}" ></int:poller>
</int-file:inbound-channel-adapter>
<bean id="acceptAll" class="org.springframework.integration.file.filters.AcceptAllFileListFilter" />
같은 수정.
파일 어댑터는 10 분마다 한 번 실행되며 방금 IN 폴더에 파일을 다시 배치했습니다. 이것은 작동해야하며 폴링이 IIRC에있는 이유입니다. 그러나 그것은 일어나지 않고 왜 나는 모른다! – Rajkumar
'방금 파일을 다시 두었습니다. ' 그것이 중요한 부분입니다 (!!!). 'AcceptOnceFileListFilter'를보십시오. 동일한 파일을 다시 처리 할 수 없습니다. 필터링 논리는 파일 이름을 기반으로합니다. 그래서, 파일을 다른 이름으로 저장하거나,'delete-source-files = "true"'on을 사용하는 한,''에서'AcceptOnceFileListFilter'를 비활성화해야합니다. 아웃 바운드 측. –
acceptAllFilter로 코드를 수정하면 정상적으로 작동합니다. 도와 주셔서 감사합니다. – Rajkumar