camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vitalii Tymchyshyn <...@tym.im>
Subject Re: Global level Configuration for multiple routes with same file endpoints
Date Sun, 14 Aug 2016 17:02:28 GMT
You can always use direct (http://camel.apache.org/direct.html) to extract
common parts of routes.

Нд, 14 серп. 2016 12:30 користувач Abhinay <abhinay.k009@gmail.com>
пише:

> 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/Global-level-Configuration-for-multiple-routes-with-same-file-endpoints-tp5786341.html
> Sent from the Camel Development mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message