How to get value of header set within a splitter ?

Solution Verified - Updated -

Issue

  • My Route is mainly reading lines from a csv file.In my Route I am trying to store "DATE" value in the header as constant and then trying to use it when it reads the next line. some how I am not able to do that can you please tell me what is wrong with the code.
<route id="_process">
            <from id="_to2" uri="direct:process"/>
            <choice id="_choice2">
                <when id="_when2">
                    <simple trim="true">${body} contains 'Report'</simple>
                    <bean id="_bean1" method="extractDate" ref="dateExchanger"/>
                    <setHeader headerName="CurDate" id="_setHeader1">
                        <constant>${body}</constant>
                    </setHeader>
                </when>
            </choice>
            <log id="_log2" message="Date -> ${header.CurDate} -- ${body}"/>
  • Output
INFO  Date -> ${body} -- 11/05/2016
INFO  Date ->  -- ABRZ,MAX Employment Casuarina,35,16,69.86,91,Local Market Local

Environment

  • Red Hat JBoss Fuse
    • 6.2.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.