323.5. 使用 StreamList

Camel 2.18 开始,生产者支持 outputType=StreamList,它使用它来构建查询的输出。这允许以流的方式处理数据(例如,Splitter EIP)可一次处理每个行,并在需要时从数据库加载数据。

from("direct:withSplitModel")
        .to("sql:select * from projects order by id?outputType=StreamList&outputClass=org.apache.camel.component.sql.ProjectModel")
        .to("log:stream")
        .split(body()).streaming()
            .to("log:row")
            .to("mock:result")
        .end();