Hi Camel Riders

I am back with a simple question I found to tough to answer myself: How do I 
access the message body in a typesafe manner like in the TODO comment below? 
Obviously implementing a processor works fine, but make things harder to read.

Thanks for advising,
Beat

                                                                              
from("direct:start-profile-pics")
                                                                                
                              .to("sql:select * from cwd_user where active='T' 
and directory_id=76644354?dataSource=confDB")
                                                                                
                              .split(body())
                                                                                
                              // TODO: setHeader("uid", 
bodyAsType(Map.class).get("username"));
                                                                                
                              .process(new Processor() {

                                                                                
                                             @Override
                                                                                
                                             public void process(Exchange 
exchange)
                                                                                
                                                                             
throws Exception {
                                                                                
                                                             Message msg = 
exchange.getIn();
                                                                                
                                                             
msg.setHeader("uid", msg.getBody(Map.class)
                                                                                
                                                                                
            .get("user_name"));
                                                                                
                                                             
msg.setHeader(Exchange.HTTP_PATH, "avatar/" + msg.getBody(Map.class)
                                                                                
                                                                                
            .get("user_name"));

                                                                                
                                             }
                                                                                
                              })
                                                                                
                              .setBody(constant(null))
                                                                                
                              .to("http4://unity-uat.apps.csintra.net/")
                                                                                
                              .bean(applicationContext
                                                                                
                                                             
.getBean("confluenceClient"),
                                                                                
                                                             
"updateProfilePic");

Reply via email to