How can I write the value of the header on a camel using spring DSL

It seems like it should be simple, sorry for the pun. I am trying to write a camel header as part of the DSL spring route. I saw the answer in Java DSL , but I searched in vain for how to get it working in DSL spring. I tried:

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

and:

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

and a few other permutations / variations, but they all just write this text verbatim (i.e. don't replace the actual title name).

What am I missing?


update: here is most 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> 
+6
source share
3 answers

I asked this question a while ago and realized that in the end I found the answer, so I should post it here if someone else finds this thread in the search. It works:

 <log message="ftping $simple{in.header.CamelFileName}" loggingLevel="DEBUG"/> 
+14
source

Try the following: either will work:

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

The syntax $simple{...} was added in Camel 2.5 to avoid collisions with Spring ${...} - maybe you are using an older version?

+5
source

Not sure if this is possible

http://camel.apache.org/logeip.html

The difference between the DSL protocol and the Log component of DSL Log is much easier and is designed to log people’s logs, such as Getting Started, etc. It can only register a message based on a simple language.

On the other hand, the Log component is a full-fledged component that includes the use of endpoints, etc. The Log component is designed to log the message itself, and you have many URI parameters to control what you would like to register.

0
source

Source: https://habr.com/ru/post/954084/


All Articles