Route Camel : Pass variables in a SQL query

2009-09-27 Thread titexe

Hello, 

I'm trying to develop a route camel who can: 

Retrieve a value from the header of a message 
and put this value in an SQL query. 

Below my configuration: 


   
  
   UPDATE CAMEL SET B='${in.header.MessageId}' WHERE
C=2 
  
   
 

When I tested this variable ${in.header.MessageId}, I retrieve its value,
unlike when I put this variable in the SQL query.

Otherwise, the SQL executes perfectly.

Thank you in advance for helping me complete this route

Best regards,

titexe
-- 
View this message in context: 
http://www.nabble.com/Route-Camel-%3A-Pass-variables-in-a-SQL-query-tp25635878p25635878.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Route Camel : Pass variables in a SQL query

2009-09-27 Thread Roman Kalukiewicz
You set the body to constant value, so you have constant value. Use EL
expression instead of constant one if you want it to be evaluated.

In simple words put  where you have  ;)

Roman

2009/9/27 titexe :
>
> Hello,
>
> I'm trying to develop a route camel who can:
>
> Retrieve a value from the header of a message
> and put this value in an SQL query.
>
> Below my configuration:
>
> 
>  
>  
>       UPDATE CAMEL SET B='${in.header.MessageId}' WHERE
> C=2
>  
>  
>  
>
> When I tested this variable ${in.header.MessageId}, I retrieve its value,
> unlike when I put this variable in the SQL query.
>
> Otherwise, the SQL executes perfectly.
>
> Thank you in advance for helping me complete this route
>
> Best regards,
>
> titexe
> --
> View this message in context: 
> http://www.nabble.com/Route-Camel-%3A-Pass-variables-in-a-SQL-query-tp25635878p25635878.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>


Re: Route Camel : Pass variables in a SQL query

2009-09-27 Thread Claus Ibsen
On Sun, Sep 27, 2009 at 8:24 PM, Roman Kalukiewicz
 wrote:
> You set the body to constant value, so you have constant value. Use EL
> expression instead of constant one if you want it to be evaluated.
>
> In simple words put  where you have  ;)
>

The  requires that you have camel-juel.jar on the classpath.
http://camel.apache.org/el.html

You can also use the simpler language which is provided out of the box.
http://camel.apache.org/simple.html

Which supports such a simple use case you have by using a header in a string.
For example just replace  with 

Camel itself have integration to many languages which you can see here:
http://camel.apache.org/languages.html


> Roman
>
> 2009/9/27 titexe :
>>
>> Hello,
>>
>> I'm trying to develop a route camel who can:
>>
>> Retrieve a value from the header of a message
>> and put this value in an SQL query.
>>
>> Below my configuration:
>>
>> 
>>  
>>  
>>       UPDATE CAMEL SET B='${in.header.MessageId}' WHERE
>> C=2
>>  
>>  
>>  
>>
>> When I tested this variable ${in.header.MessageId}, I retrieve its value,
>> unlike when I put this variable in the SQL query.
>>
>> Otherwise, the SQL executes perfectly.
>>
>> Thank you in advance for helping me complete this route
>>
>> Best regards,
>>
>> titexe
>> --
>> View this message in context: 
>> http://www.nabble.com/Route-Camel-%3A-Pass-variables-in-a-SQL-query-tp25635878p25635878.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus