0
分區計劃將無法正常工作時,拆分JSR 352的Java批次:當一個分裂的內部
裏面下面的例子只是一個分區計劃行不通 - >塊 - >分區
問題是,如果我把流程放在一個分區中,分區計劃中設置的參數將無法正常工作。如果刪除拆分並將流程放入作業中,它將正常工作。下面的例子西港島線只是打印: 空 空
,但如果我刪除拆分,將打印 valueTest1 valueTest2
謝謝!馬蒂亞斯
招聘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);
}
}