小编pba*_*bal的帖子

服务器故障后,Spring Batch恢复

我正在使用Spring Batch解析文件,并且出现以下情况:

我正在工作。这项工作必须解析给定文件。由于意外原因(例如断电),服务器发生故障,我必须重新启动计算机。现在,在重新启动服务器之后,我想从停电之前停止的那点恢复作业。这意味着,如果系统现在从10.000读取1.300行,则必须从1.301行开始读取。

如何使用Spring Batch实现此方案?

关于配置:我使用spring-integration在目录下轮询新文件。到达文件后,spring-integration将创建spring批处理作业。另外,spring-batch使用FlatFileItemReader解析文件。

spring batch-processing

9
推荐指数
1
解决办法
1万
查看次数

DefaultMessageListenerContainer 关闭过程出现问题

我是 Spring 框架的新手,我的问题如下:

我想以DefaultMessageListenerContainer编程方式实例化,我使用的代码是:

DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
container.setConnectionFactory(cf);
container.setDestination(Queue);
container.setMessageListener(Consumer);
container.setReceiveTimeout(-1);
container.setMaxConcurrentConsumers(15);
container.setConcurrentConsumers(10);
container.start();
Run Code Online (Sandbox Code Playgroud)

DefaultMessageListenerContainer为什么在取消部署项目时必须手动关闭?如果我不手动关闭容器,消费者在我的队列中保持打开状态。

当我尝试手动关闭容器(通过调用container.shutdown())时,过程卡住并且项目无法继续。如果我初始化DefaultMessageListenerContainer而不给出receiveTimeout关闭程序,则正确执行。有什么问题吗setReceiveTimeout(-1)

spring jms

5
推荐指数
1
解决办法
6756
查看次数

使用同一通道的 spring 集成的多个入站通道适配器

我正在使用 spring 集成的入站通道适配器。我想在两个不同的目录下进行轮询 - 每个文件类别一个 - 并解析位于那里的文件。我使用的代码是:

<int:channel id="inputChannel"/>

<file:inbound-channel-adapter id="fileInOne"                        
                              directory="myDirOne"
                              auto-create-directory="true"
                              channel = "inputChannel">
    <int:poller id="one" cron="1/10 * * * * *"/>
</file:inbound-channel-adapter>


<file:inbound-channel-adapter id="fileInTwo"                        
                              directory="myDirTwo"
                              auto-create-directory="true"
                              channel = "inputChannel">
    <int:poller id="two" cron="1/10 * * * * *"/>
</file:inbound-channel-adapter>
Run Code Online (Sandbox Code Playgroud)

两个入站通道适配器使用相同的通道。所以我想知道文件是从哪个入站通道适配器加载的。

integration spring

5
推荐指数
1
解决办法
3300
查看次数

标签 统计

spring ×3

batch-processing ×1

integration ×1

jms ×1