Closed
Description
Please do a quick search on Github issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:
Bug description
Setting processor property with lambda error
My code is as follows
stepBuilderFactory.get("step_name_01")
.allowStartIfComplete(true)
.<String, String>chunk(2)
.reader(itemReader())
// use lambda
.processor((Function<String, String>) (in) -> "hello " + in)
.writer(list -> list.forEach(System.out::println))
.faultTolerant() // this will new FaultTolerantStepBuilder
.skip(MyBatchException.class)
.skipLimit(1)
.build();
So I found that the item processor did not work,because the itemprocessorfunction
property of Faulttolerantstepbuilder
is null
,its itemProcessor property is null
。
protected FaultTolerantStepBuilder(SimpleStepBuilder<I, O> parent) {
super(parent);
}
protected SimpleStepBuilder(SimpleStepBuilder<I, O> parent) {
super(parent);
this.chunkSize = parent.chunkSize;
this.completionPolicy = parent.completionPolicy;
this.chunkOperations = parent.chunkOperations;
this.reader = parent.reader;
this.writer = parent.writer;
this.processor = parent.processor;
this.itemListeners = parent.itemListeners;
this.readerTransactionalQueue = parent.readerTransactionalQueue;
}
Why is the itemprocessorfunction
attribute not synchronized in the constructor ??????
Should I add the following code to the constructor ??
this.itemprocessorfunction =parent.itemprocessorfunction
Thank you