如何使用 spring DSL 在骆驼中记录标头值

编程入门 行业动态 更新时间:2024-10-27 14:22:05
本文介绍了如何使用 spring DSL 在骆驼中记录标头值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

这看起来应该很简单,请原谅双关语.我正在尝试在 spring 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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-19 22:37:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/971499.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:骆驼   如何使用   DSL   spring   标头值

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!