我們正在開發一個使用Spring集成和Rabbit MQ的POC。我們有兩個模塊生產者模塊和消費者模塊都運行在不同的JVM中。只要新文件到達,生產者模塊會在文件夾(輸入文件夾)上偵聽,創建消息,然後推送到(incoming.q.in)隊列並移動到處理文件夾。文件入站通道適配器未創建消息
在生產者模塊中我們有下面的代碼。當我在傳入文件夾中刪除大約100個文件時,大約有90個文件已處理並移動到處理文件夾,但有10個文件未移動到處理文件夾。
對於失敗的情況下,這些是在日誌文件
....
消息[13年7月30日07:34:23:023 EDT] [了taskExecutor-3] DEBUG org.springframework.integration.file。 FileReadingMessageSource添加到隊列中:[test.xml] [07/30/13 07:34:23:023 EDT] [taskExecutor-3] DEBUG org.springframework.integration.endpoint.SourcePollingChannelAdapter在輪詢期間收到否消息,返回'假'
....
成功案例
....
[13年7月30日07:34:32:032 EDT] [了taskExecutor-1] DEBUG org.springframework.integration.file.FileReadingMessageSource添加到隊列:[test_0.xml] [07/30/13 07:34:32:032 EDT] [taskExecutor-1] INFO org.springframework.integration.file.FileReadingMessageSource創建消息:[[Payload =/apps/incoming/test_0.xml] [Headers = {timestamp = 1375184072466 ,ID = d8d4cea4-A25D-4869-b287-e76cfb76f554}]]
....
下面是代碼
<file:inbound-channel-adapter id="inboundAdapter" channel="inboundChannel" directory="file:${incoming_folder}" prevent-duplicates="true" filename-pattern="*.*" auto-startup="true" >
<int:poller id="fileInboudPoller" fixed-rate="3" receive-timeout="3" time-unit="SECONDS" max-messages-per-poll="1" task-executor="taskExecutor"/>
<file:nio-locker />
</file:inbound-channel-adapter>
謝謝加里。這些文件由不同的系統生成。我們將嘗試使用臨時文件名方法並讓您知道結果。 – Mohan
它工作完美。 – Mohan