-
1. Re: How to convert a table record to xml format?
davsclaus May 27, 2013 3:09 AM (in response to axw1234)The SQL component returns the data as a List type. So you cannot convert that to a Map etc.
If you know there is only 1 row selected, then you can transform the message and pickup the first row as shown below
<to uri="sql:{{sql.selectCalls}}"/> <transform> <simple>${body[0]}</simple> </transform> ...
Then the message body would be a Map now.
Then the {{processCalls}} method on your bean, should have a Map as its type for the 1st parameter in the method signature.
There is a ticket to improve SQL component in the future so you can tell it what output type you want: https://issues.apache.org/jira/browse/CAMEL-6366
-
2. Re: How to convert a table record to xml format?
axw1234 May 28, 2013 1:56 PM (in response to davsclaus)Thank you very much.
I got the Map struct for the record.
Now I have multi records and try to using loop to fetch the data. First I hard code the
the size is 2, it repeat twice.
or
something like "CamelLoopSize" and "CamelLoopIndex".
Could you give me details about how to using them.
Thank you.
-
3. Re: How to convert a table record to xml format?
davsclaus May 29, 2013 2:22 AM (in response to axw1234)Hi
See about the splitter EIP pattern
http://camel.apache.org/splitter
... <to uri="sql:{{sql.selectCalls}}"/> <split> <simple>body</simple> <to uri="bean:callsBean?method=processCalls"></to> <to uri="log:foo"></to> </split>
Edited by: davsclaus on May 29, 2013 6:21 AM