> On 24 Mar 2016, at 12:47, Charlee Chitsuk <charlee...@gmail.com> wrote: > > My project is based on CDI and Camel-CDI. I've tried to reduce the some of > "similar" RouteBuilder concrete classes by making it to receive the > different parameter, e.g source and destination. I'm not sure if > registering manually is a suitable way or not.
In the 'nominal' use cases, you would let the Camel CDI extension do the auto-configuration of your Camel context. However, you can still do some more configuration ‘manually'. In your case, I understand you’ve tried to factorise some route definitions into some sort of templates. For example: if you have two routes: from("direct:in1").routeId("route1").to("direct:out1"); from("direct:in2").routeId(“route2").to("direct:out2"); You’ve tried to parameterised it to have a single reusable route. IMO, the Camel DSL is so compact that the duplication is so little that it’s not always worth the factorisation effort. And often the readability is better as you don’t have to understand the parametrisation when reading the code. Still if you think that is a better approach for you use case, indeed, you can declare a RouteBuilder bean @Dependent, having it parameterised depending for example on the InjectionPoint metadata and add these parameterised instances to the Camel context manually. Antonin > -- > Best Regards, > > Charlee Chitsuk > > ======================= > Application Security Product Group > *Summit Computer Co., Ltd.* <http://www.summitthai.com/> > E-Mail: char...@summitthai.com > Tel: +66-2-238-0895 to 9 ext. 164 > Fax: +66-2-236-7392 > ======================= > *@ Your Success is Our Pride* > ------------------------------------------ > > 2016-03-24 18:30 GMT+07:00 John D. Ament <johndam...@apache.org>: > >> On Thu, Mar 24, 2016 at 7:29 AM Charlee Chitsuk <charlee...@gmail.com> >> wrote: >> >>> Hi Antonin, >>> >>> Thank you very much. This answer my question. >>> >>> Please correct me if I'm wrong. Since it is a @Dependent, I can register >>> the new instance (with different route-id and parameters) to the context >> as >>> much as possible. Cloud you please help to advise further? >>> >> >> Well if you're doing manual registration, then you're not using the Camel >> CDI capability of looking up your route builders automatically. >> >> >>> >>> -- >>> Best Regards, >>> >>> Charlee Ch. >>> >>> 2016-03-24 15:20 GMT+07:00 Antonin Stefanutti <anto...@stefanutti.fr>: >>> >>>> Hi Charlee, >>>> >>>> There is actually no constraint on the scope to declare for the >>>> RouteBuilder beans that are discovered by Camel CDI. >>>> >>>> Camel CDI just gets one instance for each of them at start time and >> adds >>>> this to the Camel context. So that will equally work whether a >>> RouteBuilder >>>> is @Dependent or @AppplicationScoped generally. >>>> >>>> So that’s up to the developer to decide what’s the best scope depending >>> on >>>> its need. Obviously, if the RouteBuilder instance needs to be shared >>>> somehow, then it needs to be @ApplicationScoped. >>>> >>>> I’ll mention that to the documentation if that answers your question. >>>> >>>> Antonin >>>> >>>>> On 24 Mar 2016, at 06:49, Charlee Chitsuk <charlee...@gmail.com> >>> wrote: >>>>> >>>>> Hi, >>>>> >>>>> Regarding to the Camel CDI [1] which mentions that it provides >>>>> the Auto-detecting Camel routes. I would like to know what the CDI >>> scope >>>> of >>>>> that RouteBuilder is. Is it @ApplicationScoped? >>>>> >>>>> >>>>> [1] http://camel.apache.org/cdi.html >>>>> >>>>> -- >>>>> Best Regards, >>>>> >>>>> Charlee Ch. >>>> >>>> >>> >>