Spring Batch reference documentation provides a toggle (at the top of each page) to show code examples in XML or Java configuration styles (or both). However, there seems to be only Java config examples in the remote chunking/partitioning sections, the XML equivalent is missing. I created an issue for that: https://github.com/spring-projects/spring-batch/issues/3858.
In the meantime, here are the equivalent XML snippets for remote chunking:
Worker setup
/// 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"
/>
Manager setup
/// 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"
/>