骆驼,SQL-Component 中的变量
Camel, variables in SQL-Component
我有一个蓝图,我正在尝试将内容写入 SQL(骆驼 sql)。我似乎无法提取我想使用的变量:
<to id="myid" uri="sql:insert into RESTORE_DATA (feedFrom, queueId) values ('${headers.RESTORE_MESSAGEID}', '${headers.RESTORE_DEST}')?dataSource=myDataSource"/>
header 中的变量无法解析。如果我使用日志,我可以看到真实值:
<log message="dest = ${headers.RESTORE_DEST}" loggingLevel="INFO"/>
我应该使用什么语法?为什么这些变量以“$”开头?
阅读文档,其中显示您需要使用语法 :#${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"/>
这个问题的标题也有误导性
我有一个蓝图,我正在尝试将内容写入 SQL(骆驼 sql)。我似乎无法提取我想使用的变量:
<to id="myid" uri="sql:insert into RESTORE_DATA (feedFrom, queueId) values ('${headers.RESTORE_MESSAGEID}', '${headers.RESTORE_DEST}')?dataSource=myDataSource"/>
header 中的变量无法解析。如果我使用日志,我可以看到真实值:
<log message="dest = ${headers.RESTORE_DEST}" loggingLevel="INFO"/>
我应该使用什么语法?为什么这些变量以“$”开头?
阅读文档,其中显示您需要使用语法 :#${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"/>
这个问题的标题也有误导性