Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I log a header value in camel using spring DSL

This seems like it should be simple, pardon the pun. I'm trying to log a header in camel within a spring DSL route. I've seen the answer for Java DSL but I've been searching in vain for how to make it work in spring DSL. I've tried:

 <log message="ftping $simple{header.CamelFileName}"/>

and also:

 <log message="ftping ${header.CamelFileName}"/>

and several other permutations/variations, but all of them simply log that text verbatim (i.e. they do not substitute the actual header name).

What am I missing?


update: here's a larger portion of my xml file:

<split>
    <simple>${body}</simple>
    <setHeader headerName="CamelFileName">
        <simple>${body.batchNumber}.xml</simple>
    </setHeader>
    <log message="SLH - 5 -- marshalling an EFileBatch to XML" loggingLevel="DEBUG" />
    <marshal>
        <jaxb prettyPrint="true" contextPath="generated.gov.nmcourts.ecitation"
                partClass="generated.gov.nmcourts.ecitation.NMCitationEFileBatch"
                partNamespace="EFileBatch" />
    </marshal>

    <log message="SLH - 6 -- xslt transform to add schema location" loggingLevel="DEBUG" />
    <to uri="{{addSchemaLocationXsltUri}}"/>

    <log message="SLH - 7 -- ftp now initiating" loggingLevel="DEBUG" />
    <log message="ftping ${headers.CamelFileName}"/>

    <to uri="{{ftpOdysseyInputPath}}"/>
    <log message="SLH - 8 -- ftp now complete" loggingLevel="DEBUG" />
</split>
like image 252
Steve Harrington Avatar asked Sep 18 '13 16:09

Steve Harrington


1 Answers

Asked this question some time back, and realized that I eventually found the answer so should post it here in case someone else finds this thread in a search. This works:

<log message="ftping $simple{in.header.CamelFileName}" loggingLevel="DEBUG"/>
like image 76
Steve Harrington Avatar answered Sep 22 '22 17:09

Steve Harrington