分区计划在拆分
时不起作用以下示例只是一个: 工作 - >拆分 - >流程 - >步骤 - >块 - >分区
问题是,如果我将流放入拆分中,则分区计划中设置的参数将不起作用。如果删除拆分并将流程放在作业中,则它可以正常工作。以下示例仅打印: 空值 空
但如果删除分割,则会打印 valueTest1 valueTest2
谢谢! Matias的
作业XML
<job id="myJob" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
<split id="mySplit">
<flow id="myFlow">
<step id="myStep" >
<chunk>
<reader ref="testbatch.MyItemReader">
<properties>
<property name="prop1" value="#{partitionPlan['prop1']}"/>
</properties>
</reader>
<writer ref="testbatch.MyItemWriter"/>
</chunk>
<partition>
<plan partitions="2" >
<properties partition="0">
<property name="prop1" value="valueTest1"/>
</properties>
<properties partition="1">
<property name="prop1" value="valueTest2"/>
</properties>
</plan>
</partition>
</step>
</flow>
</split>
</job>
READER
package testbatch;
import javax.batch.api.BatchProperty;
import javax.batch.api.chunk.AbstractItemReader;
import javax.inject.Named;
@Named
public class MyItemReader extends AbstractItemReader {
@BatchProperty
String prop1;
@Override
public Object readItem() throws Exception {
System.out.println(prop1);
return null;
}
}
主要
package testbatch;
import javax.batch.operations.JobOperator;
import javax.batch.runtime.BatchRuntime;
public class TestBatch {
public static void main(String[] args) {
JobOperator jobOperator = BatchRuntime.getJobOperator();
jobOperator.start("myJob", null);
}
}