Espresso
Espresso

Reputation: 5739

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

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>

Upvotes: 5

Views: 8110

Answers (1)

Espresso
Espresso

Reputation: 5739

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>

Upvotes: 10

Related Questions