【问题标题】:Camel, variables in SQL-Component骆驼,SQL 组件中的变量
【发布时间】:2017-09-28 13:09:14
【问题描述】:

我有一个蓝图,我正在尝试将内容写入 SQL(camel sql)。我似乎无法提取我想使用的变量:

 <to id="myid" uri="sql:insert into RESTORE_DATA (feedFrom, queueId) values ('${headers.RESTORE_MESSAGEID}', '${headers.RESTORE_DEST}')?dataSource=myDataSource"/>

标头中的变量无法解析。如果我使用日志,我可以看到实际值:

<log message="dest = ${headers.RESTORE_DEST}" loggingLevel="INFO"/>

我应该使用什么语法?为什么这些变量以 '$' 开头?

【问题讨论】:

    标签: apache-camel apache-karaf blueprint-osgi


    【解决方案1】:

    阅读文档,其中显示您需要使用语法:#${header.xxx}:https://github.com/apache/camel/blob/master/components/camel-sql/src/main/docs/sql-component.adoc

    例如

    <to id="myid" uri="sql:insert into RESTORE_DATA (feedFrom, queueId) values (':#${headers.RESTORE_MESSAGEID}', ':#${headers.RESTORE_DEST}')?dataSource=myDataSource"/>
    

    这个问题的标题也有误导性

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多