我的工作定义如下:
<step id="file-transfer">
<chunk checkpoint-policy="item" item-count="10" retry-limit="10">
<reader ref="allTrusteeCustomerFilesReader">
<properties>
<property name="part-page-first-offset" value="#{partitionPlan['part-page-first-offset']}"/>
<property name="part-page-last-offset" value="#{partitionPlan['part-page-last-offset']}"/>
<property name="part-page-length" value="#{partitionPlan['part-page-length']}"/>
<property name="part-sort-field" value="#{partitionPlan['part-sort-field']}"/>
<property name="part-sort-ascending" value="#{partitionPlan['part-sort-ascending']}"/>
</properties>
</reader>
<processor ref="customerFileLocalToGoogleStorageProcessor"/>
<writer ref="customerFileWriter">
<properties>
<property name="set-google-cloud-migrated" value="true"/>
</properties>
</writer>
<skippable-exception-classes>
<include class="be.valuya.gestemps.server.file.batch.error.NoLocalStorageDataException"/>
<include class="be.valuya.gestemps.server.file.batch.error.TargetAlreadyPresentException"/>
<include class="be.valuya.gestemps.server.file.batch.error.CustomerFileAlreadyMigratedException"/>
</skippable-exception-classes>
<retryable-exception-classes>
<include class="be.valuya.gestemps.server.file.batch.error.TransferToGoogleFailedException"/>
</retryable-exception-classes>
</chunk>
<partition>
<mapper ref="customerFilePartitionMapper"/>
</partition>
<end on="COMPLETED"/>
</step>
引用的映射器创建具有定义值的属性数组,并返回它:
PartitionPlanImpl partitionPlan = new PartitionPlanImpl();
partitionPlan.setPartitions(partitionCount);
partitionPlan.setPartitionProperties(partitionProperties);
return partitionPlan;
在启动步骤时正确调用它,并返回定义了正确键的属性。
但是,我无法从我的阅读器步骤中获取分区计划属性。作业上下文属性或步骤上下文属性均不包含任何内容。我在控制台中没有看到错误。作业实例参数仅包含在运行时设置的参数。参数/属性名称没有冲突。尝试使用@BatchProperty注入它们,将字段保留为空。
批处理开始如下:
Properties properties = new Properties();
// Fill parameters...
long executionId = jobOperator.start(jobName, properties);
我想念什么?
要查看工作中的分区属性,您需要将项目读取器属性注入到项目读取器类中。例如,
分区计划是在Properties
映射中放入整数。似乎需要字符串: