Camel SQL component - simple select query result -
i'm working apache camel , i've been facing problem sql component. perform insert query simple select query wouldn't return anything. datasource configured , have no errors. read result of select query list> have blank results.
here's camel route:
from("direct:start") .to("sql:select * infos id=1 ?datasourceref=mydatasource") .beanref("mbean","monitor") .to("log:result");
and here method i'm trying use process result:
public object monitor(exchange exchange){ list<map<string,object>> l= (list<map<string,object>>) exchange.getout().getbody(); map<string,object> map = l.get(0); object str = map.get("msg"); exchange.getin().setbody(str); return str; }
i'm stuck ..
try this. worked me.
public void process(exchange exchange) throws exception { list<hashmap> out = (arraylist<hashmap>) exchange.getin().getbody(); try{ for(hashmap outcontent:out){ string message = outcontent.get("output_obj").tostring(); system.out.println(message); } }catch(exception e){ system.out.println(e); } }
Comments
Post a Comment