You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Abhinay <ab...@gmail.com> on 2016/08/12 07:22:22 UTC

Configure File End point in Global Level for all Routes

Hi Team, 

I have a requirement where I integrated Camel with Spring Boot, We have
multiple routes where each route process file with respective Processor
class and file will moves to preferred location, here my code like this, 

@Component 
public class OCCAccSumRptRouter extends RouteBuilder { 
        @Value("${file.fileLocation}") 
        private String fileLocation;  //value will be /interfaces/data/ 
        
        @Value("${file.fileNamePattern}") 
        private String fileNamePattern; //File pattern will different for
each route as each file processing logic different. 
        
        public void configure() throws Exception { 
                String file =
"file:"+fileLocation+"?include="+fileNamePattern+"&readLock=rename"; 
               
from(file).doTry().bean(MyProcessor.class,"processMessage(${body},
${header.CamelFileNameOnly})").to("file:"+fileLocation+"/.done?FileName=${file:name.noext}-${date:now:yyyyMMddHHmmssSSS}.${file:ext}").doCatch(Exception.class).to("file:"+fileLocation+"/.failed?FileName=${file:name.noext}-${date:now:yyyyMMddHHmmssSSS}.${file:ext}").end(); 
        } 
} 

Above route will process the file to MyProcessor class after on basis of
success file will moves to '.done' folder or if process fails file need to
move '.failed' and renamed with current time stamp. 

So here my requirement is as right now we have 20+ routes and will get
3times of current number, defining file end point (to("destination")) in
each route is good, could you please help me out want to configure in global
level so that I don't need mention in each routes as file end point is
common to all routes is same . 

Thanks, 
Abhinay K 



--
View this message in context: http://camel.465427.n5.nabble.com/Configure-File-End-point-in-Global-Level-for-all-Routes-tp5786346.html
Sent from the Camel - Users mailing list archive at Nabble.com.