Camel- Split List<MyObj> and process each java object - XML Config

元气小坏坏 提交于 2019-12-06 02:38:14

问题


I am unable to split Java objects that are in a List. How I can tokenize / convert Body to to single java objects?

    <route id="cleanupMigratedFiles" autoStartup="true">

        <from uri="timer://kickoff?period=5s" />
        <bean ref="migrationProcessor" method="getCacheDeleteObjects" /> <!--  this gives me a List-of-CacheMigr -->
        <log message="\n\t########\n\tCleanupMigrated file: ${body}" />
        <pipeline>
            <split>
                <tokenize /> <!-- How to tokenize a List-of-CacheMigr  -->
                <convertBodyTo type="era.oddw.entity.CacheMigr" /> <!-- Do I need this? -->
                <log message="\n\t########\n\tCleanupMigrated file: ${body}" />
            </split>
        </pipeline>
    </route>

回答1:


Found the answer after some more reading .. The following tag tokenized List properly : ${body}

Thanks to Camel guys.

        <split streaming="true">
            <simple>${body}</simple>
            <convertBodyTo type="era.oddw.entity.CacheMigr" /> 
            <log message="\n\t########\n\tCleanupMigrated file each: ${body}" />
        </split>


来源:https://stackoverflow.com/questions/18365209/camel-split-listmyobj-and-process-each-java-object-xml-config

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!