use http://camel.apache.org/recipient-list.html

something like this should allow you to dynamically determine the next
endpoint based on the map and xpath result...

replace you inline Processor and to(rcvQSRmttr) with this

recipientList().method(MessageRouter.class, "routeTo")
...

public class MessageRouter {
    public String routeTo(@XPath("/order/city") String key) {
        return apc3AddrMap.get(key);
    }
}


aronftd wrote:
> 
> how can i modify rcvQSRmttr  bases xpath("/order/city") and a map , 
> xpath("/order/city").toString() as the key of the map;
> appricate for you advice!
> 
> rcvQSRmttr = apc3AddrMap.get(xpath("/order/city").toString());    
> public class FileToJMSRouter extends RouteBuilder {
>       private Map<String,String> apc3AddrMap;
>       public String rcvQ;
>       public String sendQ;
>     @Override
>     public void configure() throws Exception {
>         // load file orders from src/data into the JMS queue
> //            DataFormat jaxb = new
> JaxbDataFormat("com.sinosky.cdip.route.xsd.rply");
>       String sendQStr = "jms:" + sendQ;
>       String rcvQStr = "jms:" + rcvQ;
>       String rcvQSRmttr = "jmsRmt:" + rcvQ;
>       
>         errorHandler(defaultErrorHandler()
>                 .maximumRedeliveries(2)
>                 .redeliveryDelay(1000)
>                 .retryAttemptedLogLevel(LoggingLevel.WARN));            
>       from("file:src/data?delay=1000")
>       .to(sendQStr)
>     
> .to("file:logs/send?fileName=${date:now:yyyy-MM-dd}/${exchangeId}.xml")
>       .process(new Processor() {              
>               public void process(Exchange exchange) throws Exception {
>                       rcvQSRmttr = 
> apc3AddrMap.get(xpath("/order/city").toString());                          
>                       }
>               })
>       .to(rcvQSRmttr)
>       .setBody(constant("success"))
>       .to(rcvQStr)
>     
> .to("file:logs/receive?fileName=${date:now:yyyy-MM-dd}/${exchangeId}.xml");
>     }
> 


-----
Ben O'Day
IT Consultant -http://benoday.blogspot.com

--
View this message in context: 
http://camel.465427.n5.nabble.com/how-can-i-modify-variable-bases-xpath-in-configure-method-tp4330030p4330067.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to