You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kalber <Ka...@swslt.com> on 2013/09/05 14:57:57 UTC

Camel 2.11.1, sql component returns a LinkedCaseInsensitiveMap for evry row, not a ArrayList

I configured this route :
from("sql:select obj_code, prv_targa, stc_pccode, prv_prodtela, prv_modtela,
prv_tipobus from cust_positions where obj_org in ('ICT') and obj_class in
('BUS') order by prv_concessi?dataSource=#dataSource.infor&noop=true")
				.process(new ExportFileConvert());

in the ExportFileConvert i recive for evry row and LinkedCaseInsensitiveMap
not how i excpected once an ArrayList of LinkedCaseInsensitiveMap;

How can configure the route to recive an ArrayList<LinkedCaseInsensitiveMap>
?

NB:

Using a template with the direct component it works, here the code ;

public void configure() throws Exception {
	from("direct:busmsg.select.sms_bus")
		.to("sql:SELECT tipo_msg, from_unixtime(rcv_time) rcv_time,
from_unixtime(event_time) event_time, codazi, matr_bus, linea, corsa,
palina, anticipo, ritardo FROM busmsg.sms_bus_# where 
date_format(from_unixtime(event_time), '%Y-%m-%d %H') > #  and 
date_format(from_unixtime(event_time), '%Y-%m-%d %H') <= # order by
from_unixtime(rcv_time)?dataSource=#dataSource.busmsg")
			.bean(new BusmsgConvert(), "convertMap2List");
}

  
ProducerTemplate template = camelWrapper.createProducerTemplate();
 List<List&lt;?>> response = (List<List&lt;?>>) template.requestBody(
			"direct:busmsg.select.sms_bus",
			new Object[] { processConfig.composeStartElabDate(),
					processConfig.composeEndElabDate() });



-----
kh
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-2-11-1-sql-component-returns-a-LinkedCaseInsensitiveMap-for-evry-row-not-a-ArrayList-tp5738761.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel 2.11.1, sql component returns a LinkedCaseInsensitiveMap for evry row, not a ArrayList

Posted by kalber <Ka...@swslt.com>.
thanks that's it



-----
kh
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-2-11-1-sql-component-returns-a-LinkedCaseInsensitiveMap-for-evry-row-not-a-ArrayList-tp5738761p5738846.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel 2.11.1, sql component returns a LinkedCaseInsensitiveMap for evry row, not a ArrayList

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

Check the documentation
http://camel.apache.org/sql-component.html

You can find the answer there, see useIterator option.

On Thu, Sep 5, 2013 at 4:36 PM, kalber <Ka...@swslt.com> wrote:
> Î receive for every row of the resulset  an exchange - body with a
> LinkedCaseInsensitiveMap<V> object like this :
> {OBJ_CODE=6036.1, PRV_TARGA=EL809DT, STC_PCCODE=3232.PC, PRV_PRODTELA=null,
> PRV_MODTELA=530 K, PRV_TIPOBUS=null}
>
> My question is how can a configure out the from endpoint to send me once an
> ArrayList< LinkedCaseInsensitiveMap<V>>
> so that i can elaborate in my processor all records in one step.
>
> My  problem is that i receive not one ArrayList with all
> LinkedCaseInsensitiveMap but evry single row as a LinkedCaseInsensitiveMap.
>
>
>
>
>
>
>
>
>
>
> -----
> kh
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-2-11-1-sql-component-returns-a-LinkedCaseInsensitiveMap-for-evry-row-not-a-ArrayList-tp5738761p5738783.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

Re: Camel 2.11.1, sql component returns a LinkedCaseInsensitiveMap for evry row, not a ArrayList

Posted by kalber <Ka...@swslt.com>.
Î receive for every row of the resulset  an exchange - body with a
LinkedCaseInsensitiveMap<V> object like this :
{OBJ_CODE=6036.1, PRV_TARGA=EL809DT, STC_PCCODE=3232.PC, PRV_PRODTELA=null,
PRV_MODTELA=530 K, PRV_TIPOBUS=null}

My question is how can a configure out the from endpoint to send me once an
ArrayList< LinkedCaseInsensitiveMap<V>>
so that i can elaborate in my processor all records in one step.

My  problem is that i receive not one ArrayList with all
LinkedCaseInsensitiveMap but evry single row as a LinkedCaseInsensitiveMap.










-----
kh
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-2-11-1-sql-component-returns-a-LinkedCaseInsensitiveMap-for-evry-row-not-a-ArrayList-tp5738761p5738783.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel 2.11.1, sql component returns a LinkedCaseInsensitiveMap for evry row, not a ArrayList

Posted by Claus Ibsen <cl...@gmail.com>.
What is the problem?

I assume you get a Map representation of the row. And a List to
contain the rows, eg List<Map>.




On Thu, Sep 5, 2013 at 2:57 PM, kalber <Ka...@swslt.com> wrote:
> I configured this route :
> from("sql:select obj_code, prv_targa, stc_pccode, prv_prodtela, prv_modtela,
> prv_tipobus from cust_positions where obj_org in ('ICT') and obj_class in
> ('BUS') order by prv_concessi?dataSource=#dataSource.infor&noop=true")
>                                 .process(new ExportFileConvert());
>
> in the ExportFileConvert i recive for evry row and LinkedCaseInsensitiveMap
> not how i excpected once an ArrayList of LinkedCaseInsensitiveMap;
>
> How can configure the route to recive an ArrayList<LinkedCaseInsensitiveMap>
> ?
>
> NB:
>
> Using a template with the direct component it works, here the code ;
>
> public void configure() throws Exception {
>         from("direct:busmsg.select.sms_bus")
>                 .to("sql:SELECT tipo_msg, from_unixtime(rcv_time) rcv_time,
> from_unixtime(event_time) event_time, codazi, matr_bus, linea, corsa,
> palina, anticipo, ritardo FROM busmsg.sms_bus_# where
> date_format(from_unixtime(event_time), '%Y-%m-%d %H') > #  and
> date_format(from_unixtime(event_time), '%Y-%m-%d %H') <= # order by
> from_unixtime(rcv_time)?dataSource=#dataSource.busmsg")
>                         .bean(new BusmsgConvert(), "convertMap2List");
> }
>
>
> ProducerTemplate template = camelWrapper.createProducerTemplate();
>  List<List&lt;?>> response = (List<List&lt;?>>) template.requestBody(
>                         "direct:busmsg.select.sms_bus",
>                         new Object[] { processConfig.composeStartElabDate(),
>                                         processConfig.composeEndElabDate() });
>
>
>
> -----
> kh
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-2-11-1-sql-component-returns-a-LinkedCaseInsensitiveMap-for-evry-row-not-a-ArrayList-tp5738761.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