Reputation: 655
I am building a route dynamically based on some conditions. For example, based on the configuration, the from route can be a quartz2 or file component. All the other portions of the route are same.
File Component Route
from(file://E:/Camel)
.setProperty("fileName", simple("${file:onlyname}"))
.process(camelprocessor)
.to(queue)
.log("Posted message to Queue");
Quartz2 Component Route
from(quartz2://schedulername?cron=0+0/5+12-18+?+*+MON)
.pollEnrich(file://E:/Camel)
.setProperty("fileName", simple("${file:onlyname}"))
.process(camelprocessor)
.to(queue)
.log("Posted message to Queue");
As you see in the routes above, the last four lines are same for both the route. Currently, we are connecting the from portion (timer or quartz2 component) of the route to the common route with the help of direct component.
Is this a right approach? Will there be any performance issue if we use direct component?
The other options that we have are thinking are :
I appreciate any advice regarding the above.
Upvotes: 2
Views: 1010
Reputation: 842
You can add direct component and call from the common route as you say. As far my knowledge, I will suggest not to use pollenrich.
Because using pollenrich you cannot able to process all file at instance (i.e) pollenrich will can able to process 10 instance at a time. If you need to process more then 10 file, you can't.
Instead of using quartz and the file component within a route. You can add up both as single endpoint like this,
<from uri="file://pathto//yourfile?scheduler=quartz2&antInclude=*.xml&scheduler.cron={{schedularName.Scheduler}}"/>
I hope it might helps you.
Upvotes: 1