You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dermoritz <ta...@hotmail.com> on 2014/11/20 17:44:31 UTC

camel sql, select is returning many exchanges of type map instead of one List>

I just tried out camel-sql component (with mysql datasource).

The documentation states that select queries should return one Exchange with
List<Map&lt;String, object>>
with the given test:
List<?> received = assertIsInstanceOf(List.class,
mock.getReceivedExchanges().get(0).getIn().getBody());

I created a simple table with 2 entries and a very simple route:
 from("sql:select * from lookup?dataSource=" + LOOK_UP_DS).to(MOCK_A);

In my case the test above fails because i get 2 exchanges with each
containing the map. Is there any way to get the behavior documented? at the
end i need to convert the result into a csv String.

thanks in advance



--
View this message in context: http://camel.465427.n5.nabble.com/camel-sql-select-is-returning-many-exchanges-of-type-map-instead-of-one-List-Map-tp5759374.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel sql, select is returning many exchanges of type map instead of one List>

Posted by dermoritz <ta...@hotmail.com>.
I just can say thanks!

(by the way all in all camel i the best api i ever worked with)



--
View this message in context: http://camel.465427.n5.nabble.com/camel-sql-select-is-returning-many-exchanges-of-type-map-instead-of-one-List-Map-tp5759374p5759406.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel sql, select is returning many exchanges of type map instead of one List>

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

That is the expected behavior when using the consumer. See the
useIterator option in the docs
http://camel.apache.org/sql-component

On Thu, Nov 20, 2014 at 5:44 PM, dermoritz <ta...@hotmail.com> wrote:
> I just tried out camel-sql component (with mysql datasource).
>
> The documentation states that select queries should return one Exchange with
> List<Map<String, object>>
> with the given test:
> List<?> received = assertIsInstanceOf(List.class,
> mock.getReceivedExchanges().get(0).getIn().getBody());
>
> I created a simple table with 2 entries and a very simple route:
>  from("sql:select * from lookup?dataSource=" + LOOK_UP_DS).to(MOCK_A);
>
> In my case the test above fails because i get 2 exchanges with each
> containing the map. Is there any way to get the behavior documented? at the
> end i need to convert the result into a csv String.
>
> thanks in advance
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-sql-select-is-returning-many-exchanges-of-type-map-instead-of-one-List-Map-tp5759374.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/