如何使用Spring DSL在骆驼中记录标头值 [英] How can I log a header value in camel using spring DSL
问题描述
这看起来应该很简单,对不起.我正在尝试在春季DSL路由中的骆驼中记录标头.我已经看到了 Java DSL 的答案,但是我一直在徒劳地寻找如何使其在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}"/>
还有:
<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).
我想念什么?
更新:这是我的xml文件的较大部分:
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>
推荐答案
前段时间提出了这个问题,并意识到我最终找到了答案,因此应将其发布在此处,以防其他人在搜索中找到该线程.这有效:
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"/>
这篇关于如何使用Spring DSL在骆驼中记录标头值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!