Spring 批处理 4.x 集成 XML 远程分块配置
Spring batch 4.x integration XML configuration for remote chunking
我正在将 Spring 批次从 3.x 升级到 4.3。目前我们正在使用 Spring 批处理集成和 XML 配置通过 MQ 发送和接收消息。 Spring 第 4 批引入 @EnableBatchIntegration
和相应的 XML XSD 是
xmlns:batch-int="http://www.springframework.org/schema/batch-integration"
http://www.springframework.org/schema/batch-integration
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd
能否请您告诉我如何在 XML 中对以下两个 xml 元素配置使用 batch-int 配置?
<batch-int:remote-chunking-manager message-template="" step="" reply-channel="" id=""/>
<batch-int:remote-chunking-worker output-channel="" item-writer="" input-channel="" id=""/>
Spring 批处理参考文档提供了一个切换开关(在每个页面的顶部)以显示 XML 或 Java 配置样式(或两者)的代码示例。但是,remote chunking/partitioning sections, the XML equivalent is missing. I created an issue for that: https://github.com/spring-projects/spring-batch/issues/3858.
中似乎只有 Java 个配置示例
同时,以下是远程分块的等效 XML 片段:
工人设置
/// java config
@Bean
public IntegrationFlow worker() {
return workerBuilder
.inputChannel(requests()) // requests received from the manager
.outputChannel(replies()) // replies sent to the manager
.itemProcessor(itemProcessor())
.itemWriter(itemWriter())
.build();
}
/// xml config
<batch-int:remote-chunking-worker
id="worker"
input-channel="requests"
output-channel="replies"
item-processor="itemProcessor"
item-writer="itemWriter"
/>
经理设置
/// java config
@Bean
public TaskletStep managerStep() {
return managerStepBuilderFactory.get("managerStep")
.chunk(100)
.reader(itemReader())
.outputChannel(requests()) // requests sent to workers
.inputChannel(replies()) // replies received from workers
.build();
}
// xml config: there no one to one mapping, but you can use the following:
<batch-int:remote-chunking-manager
id="managerStep"
message-template="messageTemplate" <!-- template with "requests" as default destination -->
step="step" <!-- reference to a chunk-oriented step with required itemReader and chunkSize=100, the writer will be replaced with a ChunkMessageChannelItemWriter automatically -->
reply-channel="replies"
/>
我正在将 Spring 批次从 3.x 升级到 4.3。目前我们正在使用 Spring 批处理集成和 XML 配置通过 MQ 发送和接收消息。 Spring 第 4 批引入 @EnableBatchIntegration
和相应的 XML XSD 是
xmlns:batch-int="http://www.springframework.org/schema/batch-integration"
http://www.springframework.org/schema/batch-integration
https://www.springframework.org/schema/batch-integration/spring-batch-integration.xsd
能否请您告诉我如何在 XML 中对以下两个 xml 元素配置使用 batch-int 配置?
<batch-int:remote-chunking-manager message-template="" step="" reply-channel="" id=""/>
<batch-int:remote-chunking-worker output-channel="" item-writer="" input-channel="" id=""/>
Spring 批处理参考文档提供了一个切换开关(在每个页面的顶部)以显示 XML 或 Java 配置样式(或两者)的代码示例。但是,remote chunking/partitioning sections, the XML equivalent is missing. I created an issue for that: https://github.com/spring-projects/spring-batch/issues/3858.
中似乎只有 Java 个配置示例同时,以下是远程分块的等效 XML 片段:
工人设置
/// java config
@Bean
public IntegrationFlow worker() {
return workerBuilder
.inputChannel(requests()) // requests received from the manager
.outputChannel(replies()) // replies sent to the manager
.itemProcessor(itemProcessor())
.itemWriter(itemWriter())
.build();
}
/// xml config
<batch-int:remote-chunking-worker
id="worker"
input-channel="requests"
output-channel="replies"
item-processor="itemProcessor"
item-writer="itemWriter"
/>
经理设置
/// java config
@Bean
public TaskletStep managerStep() {
return managerStepBuilderFactory.get("managerStep")
.chunk(100)
.reader(itemReader())
.outputChannel(requests()) // requests sent to workers
.inputChannel(replies()) // replies received from workers
.build();
}
// xml config: there no one to one mapping, but you can use the following:
<batch-int:remote-chunking-manager
id="managerStep"
message-template="messageTemplate" <!-- template with "requests" as default destination -->
step="step" <!-- reference to a chunk-oriented step with required itemReader and chunkSize=100, the writer will be replaced with a ChunkMessageChannelItemWriter automatically -->
reply-channel="replies"
/>