camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alessandro Rontani <>
Subject Re: Unable to resolve named parameter in camel route
Date Sun, 27 Dec 2015 21:40:45 GMT
Your problem is that the parameters *numbersubscribers* and and *id* must
be present as headers in the message: when your message reach the jdbc
component the body of the message contains the query, but cannot find the

Doing something like this can solve your problem:

.setBody(constant(serverData.getSql())).to("jdbc:"+ serverData.getUrl() +
.setBody(constant("insert into new_raw_table_test (numbersubscribers, id)
.to("jdbc:" + serverData.getUrl() +
.process(custom application logic);

your first query on JDBC component returns a list (representing the db rows
returned), and every element of the list is a map with the column name as
key and the value in the row as value. The code in bold above put into the
headers the values retrieved from the body. The solution suggested works if
the first DB call returns at least a row, if there is no result probably it
will raise an ArrayOutOfBound exception

I hope that the syntax that i have used is correct (i use always the XML
notation, not the Java one ^_^ )

Best Regards
Alessandro Rontani
*Siamo quello che facciamo ripetutamente. L'eccellenza non e' un atto, ma
abitudine - *Aristotele

2015-12-23 9:54 GMT+01:00 ghoshp29 <>:

> One typo in the camel route syntax. Correct syntax used in application is
> below -
> from("timer://foo?period="+serverData.getTimer()).threads(serverData.getNumberOfInstances()).setBody(constant(serverData.getSql())).to("jdbc:"
> + serverData.getUrl() + serverData.getUserId()).setBody(constant("insert
> into new_raw_table_test (numbersubscribers, id) values(:?numbersubscribers,
> :?id)")).
> to("jdbc:" + serverData.getUrl() +
> serverData.getUserId()+"?allowNamedParameters=true&outputType=SelectOne&useHeadersAsParameters=true&resetAutoCommit=false").process(custom
> application logic);
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message