如何在spring-batch中创建异步步骤?

时间:2015-04-23 14:07:09

标签: java spring asynchronous spring-batch spring-integration

我有一个现有的弹簧批Step,并希望用Async处理器+编写器重构它。

StepBuilderFactory steps;
steps.get("test").chunk(1000)
        .reader(new FlatFileItemReader<String>())
        .processor(new AsyncItemProcessor<String, String>())
        .writer(new AsyncItemWriter<String>())
        .build();

这不起作用并抱怨处理器:

The method processor(ItemProcessor<? super Object,? extends Object>) in the type SimpleStepBuilder<Object,Object> is not applicable for the arguments (AsyncItemProcessor<String,String>)

如何使用异步构建步骤?

1 个答案:

答案 0 :(得分:2)

您需要将处理器的输出包装到RIGHT以便AsyncItemProcessor。

API