Jojje
Jojje

Reputation: 1779

Camel, variables in SQL-Component

I have a blueprint in which i'm trying to write stuff to SQL (camel sql). I can't seem to extract the variables that I want to use:

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

The variables from the header can't be resolved. I can see the real values if i use a log:

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

What syntax should I use? Why do these variables start with '$' ?

Upvotes: 0

Views: 528

Answers (1)

Claus Ibsen
Claus Ibsen

Reputation: 55750

Read the documentation, which shows you need to use syntax :#${header.xxx}: https://github.com/apache/camel/blob/master/components/camel-sql/src/main/docs/sql-component.adoc

eg

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

Also the title of this question is misleading

Upvotes: 2

Related Questions