简体   繁体   English

Apache骆驼如何在SetBody中插入属性

[英]Apache camel how insert property in SetBody

I am creating a message in my route, using: 我正在使用以下方法在路线中创建一条消息:

    <setBody id="_setBody1">
                        <constant>
<![CDATA[
           <?xml version="1.0" encoding="UTF-8"?&>
    ..........
            <mes:CalendarView MaxEntriesReturned="5" StartDate="(property.DateStart)" EndDate="(property.EndDate)"/>

But property doesn't work. 但是财产不起作用。 In log I see: 在日志中,我看到:

 <mes:CalendarView MaxEntriesReturned="5" StartDate="(property.DateStart)" EndDate="(property.EndDate)"/>

How I can insert property in message? 如何在消息中插入属性?

It looks like you want to set some properties inside a static content of XML. 看起来您想在XML的静态内容中设置一些属性。 I suggest using one of the templates.. such as velocity. 我建议使用模板之一..如速度。 It will allow you to do property replacement and manage the static content outside of the route (which is handy for testing and other maintenance) 它将允许您进行属性替换并管理路由外的静态内容(这对于测试和其他维护非常方便)

Yes, i created property before: 是的,我之前创建过物业:

  <setProperty id="_setProperty1" propertyName="DateStart">
                <groovy>new java.text.SimpleDateFormat('yyyy-MM-dd').format(request.body.getStartDate())</groovy>
            </setProperty>

But i want to insert this property in content of xml, inside Apache Camel route. 但是我想在Apache Camel路由内的xml内容中插入此属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM