1 回答

TA貢獻2019條經驗 獲得超9個贊
如果您在內部過濾而不是使用 JsonPath 來實施聚合策略,可能會更容易,因此更容易理解。
實際上,split()默認情況下使用的方法不會給出您期望的結果
這是一個例子:
@Component
public class ProcessHandler extends RouteBuilder {
? ? ? ? ? ? @Override
? ? ? ? ? ? protected void defineRoute() throws Exception {
? ? ? ? ? ? DataFormat csv = new BindyCsvDataFormat(CsvModel.class);
? ? ? ? ? ? rest("/")
? ? ? ? ? ? ? ? ? ? .post().produces("application/json")
? ? ? ? ? ? ? ? ? ? ? ? ?.route()
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? .unmarshal(csv)
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? .split().method(ItemsSplittingStrategy.class, "splitItems")
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? .parallelProcessing()
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? .marshal().json(JsonLibrary.Gson)
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? .end()
? ? ? ? ? ? ? ? ? ? .to("file:/file.json");
? ? }
}
我還邀請您檢查可用于拆分器和聚合器及其組合的所有功能。
添加回答
舉報