-
1. Re: Tighter CDI + Camel integration
kcbabo Jul 14, 2011 7:37 AM (in response to tfennelly)Tom and I had a quick chat on IRC about this, so I'll summarize for the forum thread.
The main thing we are trying to do is make CDI beans available as bean references within a Camel route. It's common to augment the processing logic of a route with a bean definition and bean references can also be used in endpoint configuration (IIRC) to influence component behavior (e.g. filtering). This type of thing is specific to the Camel route and distinct from CDI services which have been registered on the bus.
We discussed possible ways to wire this in and Tom believes that we have most of the plumbing in place today. What we need to add is the ability to register CDI beans by name. The @Named annotation looks promising for this purpose.
One other item we discussed is the use of the Camel test support (test/mock endpoints) in a Camel MixIn. One of the nice things here is that you can test @Reference invocations using mock endpoints defined in Camel. I'm sure there's lots of other possibilities too.
-
2. Re: Tighter CDI + Camel integration
tfennelly Jul 14, 2011 12:07 PM (in response to kcbabo)I've rejigged a bit and have the same thing working for any CDI bean in the module (I'm assuming it won't work for beans outside the deployment unit... need to check that).
Code is in the same place...
- Components: https://github.com/tfennelly/jboss-switchyard-components/tree/camel+cdi
- Quickstarts: https://github.com/tfennelly/jboss-switchyard-quickstarts/tree/camel+cdi (I modified the "camel-service" quickstart)
Specifically... I added a dumbo SallyLogger bean to the "camel-service" quickstarts, which I then invoke in the Camel RouteBuilder class. That should give you an idea.
-
3. Re: Tighter CDI + Camel integration
kcbabo Jul 15, 2011 7:57 AM (in response to tfennelly)Fantastic! Haven't had a chance to play with it yet (just looked at your example code), but this looks like it's exactly what we were looking for. Will dig a bit deeper later today.