it is ok but i dont like this solution :(. Beacuse I dont wan to use
JDBCTEMPLATE for update column. Please show me a way for proper solution.

public class RouteDatabaseToJms extends RouteBuilder {
        @Override
        public void configure() throws Exception {
                                 
        DataSource ds = this.getContext().getRegistry().lookup("dataSource",
DataSource.class);
        final JdbcTemplate jdbc = new JdbcTemplate(ds);
                
                
        from("timer://foo?period=60000").setBody(constant("select * from
AIRPORT")).to("jdbc:dataSource").
        process(new Processor(){
                        @Override
                        public void process(Exchange exchange) throws Exception 
{                                                                               
                
                                ArrayList<HashMap&lt;String, Object>> data =
exchange.getIn().getBody(ArrayList.class);
                                for (HashMap<String, Object> item : data){      
                                                                                
        
                                        
System.out.println("DATABASE:::item.IATA_CODE
:"+((String)item.get("IATA_CODE")));
                                }
                        }                       
        }).to("jms:queue:airport");
        
        from("jms:queue:airport").process(new Processor(){

                        @Override
                        public void process(Exchange exchange) throws Exception 
{
                                
                                ArrayList<HashMap&lt;String, Object>> data =
exchange.getIn().getBody(ArrayList.class);
                                for (HashMap<String, Object> item : data){      
                                
                                        jdbc.execute("update airport set 
description_tr='tamam' where
id="+(BigDecimal)item.get("ID"));
                                        System.out.println("JMS:::item.IATA_CODE
:"+((String)item.get("IATA_CODE")));
                                }                               
                        } 
                        
        });     
        
        }

}


--
View this message in context: 
http://camel.465427.n5.nabble.com/How-can-I-update-database-table-by-using-camel-routing-tp4994185p4994211.html
Sent from the Camel Development mailing list archive at Nabble.com.

Reply via email to