Spring Integration - 在服务器重新启动后,默认情况下从入站文件适配器重新处理消息

时间:2015-02-25 23:22:13

标签: java spring file-io spring-integration messaging

我有一个文件入站适配器连接到文件输出绑定网关。以下是配置。

*

*

当天早些时候在一个实例上按预期处理了一堆文件。另一个实例由于某种原因重新启动,几个小时后它开始处理已经在另一个实例上处理的消息.it导致出站网关的每个消息都有一个文件未发现的异常

2015-02-19 00:46:15,761 [task-scheduler-8] INFO org.springframework.integration.file.FileWritingMessageHandler - 无法移动文件'/ tcserver / mounts / file_int / source / b31d688bc85c429bb4748f56a38f4e61'。使用复制和删除后备。

2015-02-19 00:46:15,762 [task-scheduler-8] DEBUG org.springframework.integration.handler.LoggingHandler - (内部bean)#8收到消息:[Payload = org.springframework.integration.MessageHandlingException :无法将消息有效负载写入文件] [Headers = {timestamp = 1424328375761,id = ad494ba5-795f-40d0-b523-74998088028e}]

2015-02-19 00:46:15,762 [task-scheduler-8]错误org.springframework.integration.handler.LoggingHandler - org.springframework.integration.MessageHandlingException:无法将消息有效负载写入文件     在org.springframework.integration.file.FileWritingMessageHandler.handleRequestMessage(FileWritingMessageHandler.java:293)     在org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:134)     在org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73) .....

引起:java.io.FileNotFoundException:/ tcserver / mounts / file_int / source / b31d688bc85c429bb4748f56a38f4e61(没有这样的文件或目录)     at java.io.FileInputStream.open(Native Method)     在java.io.FileInputStream。(FileInputStream.java:146)     在org.springframework.util.FileCopyUtils.copy(FileCopyUtils.java:63)     在org.springframework.integration.file.FileWritingMessageHandler.handleFileMessage(FileWritingMessageHandler.java:352)     在org.springframework.integration.file.FileWritingMessageHandler.handleRequestMessage(FileWritingMessageHandler.java:277)

1)spring在服务器系统关闭之前是否保存系统状态。 2)对于为什么会发生这种情况的任何解释都会有很大帮助

1 个答案:

答案 0 :(得分:0)

如果您有多个实例引用相同的源目录,则需要使用持久文件列表过滤器以及MetadataStore(例如Redis)来跨实例共享状态。

请参阅the documentation