camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ben.oday" <ben.o...@initekconsulting.com>
Subject Re: how can i modify variable bases xpath in configure() method
Date Sat, 23 Apr 2011 14:40:34 GMT
see this example...http://camel.apache.org/recipientlist-annotation.html


aronftd wrote:
> 
> i define MessageRouter in spring xml ,when i be in debug mode ,i find the
> apc3AddrMap property is null; 
> but i test  MessageRouter  not in camel ,it can get  the map property , 
> how can i do ,thanks!     
> 
> 
> 
> public class FileToJMSRouter extends RouteBuilder { 
>         
>         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;     
>         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")     
>     .recipientList().method(MessageRouter.class, "routeTo") 
>     .setBody(constant("success")) 
>     .to(rcvQStr) 
>    
> .to("file:logs/receive?fileName=${date:now:yyyy-MM-dd}/${exchangeId}.xml"); 
>     ; 
>     } 
>         public String getRcvQ() { 
>                 return rcvQ; 
>         } 
>         public void setRcvQ(String rcvQ) { 
>                 this.rcvQ = rcvQ; 
>         } 
>         public String getSendQ() { 
>                 return sendQ; 
>         } 
>         public void setSendQ(String sendQ) { 
>                 this.sendQ = sendQ; 
>         } 
> } 
> 
> 
> public class MessageRouter { 
>         private Map&lt;String,String&gt; apc3AddrMap; 
> 
>         public Map&lt;String, String&gt; getApc3AddrMap() { 
>                 return apc3AddrMap; 
>         } 
> 
>         public void setApc3AddrMap(Map&lt;String, String&gt; apc3AddrMap)
> { 
>                 this.apc3AddrMap = apc3AddrMap; 
>         } 
>         public String routeTo(@XPath("/R/RCV/APC3/text()") String key) { 
>             String str = apc3AddrMap.get(key); 
>         return str; 
>     } 
> 
> }
> 

-----
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-tp4330030p4334748.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message