You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Bruno Borges <br...@gmail.com> on 2012/07/05 07:19:55 UTC

CDI and Camel

Guys, a few things about the new Camel-CDI component:

1) It seems the docs for the CDI component are not accurate: it links to
some pages that are not available anymore. (like the GitHub links)

2) How can it inject a CdiCamelContext if it is not defined anywhere? (and
this class doesn't have @Named)



*Bruno Borges*
(21) 7672-7099
*www.brunoborges.com*

Re: CDI and Camel

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi it seems camelpe manges a single context. I pushed some idea to manage
multiple ones here https://github.com/rmannibucau/camel-cdi-extension

- Romain
Le 5 juil. 2012 07:23, "Bruno Borges" <br...@gmail.com> a écrit :

> I think this project has a more complete implementation of an integration
> between Camel and CDI: https://github.com/obergner/camelpe
>
>
> *Bruno Borges*
> (21) 7672-7099
> *www.brunoborges.com*
>
>
>
> On Thu, Jul 5, 2012 at 2:19 AM, Bruno Borges <br...@gmail.com>
> wrote:
>
> > Guys, a few things about the new Camel-CDI component:
> >
> > 1) It seems the docs for the CDI component are not accurate: it links to
> > some pages that are not available anymore. (like the GitHub links)
> >
> > 2) How can it inject a CdiCamelContext if it is not defined anywhere?
> (and
> > this class doesn't have @Named)
> >
> >
> >
> > *Bruno Borges*
> > (21) 7672-7099
> > *www.brunoborges.com*
> >
> >
>

Re: CDI and Camel

Posted by Łukasz Dywicki <lu...@code-house.org>.
Hey,
Camel-pe is old and not supported extension written by Olaf while ago. It have to be rewritten to be independant from any particular CDI container, including Weld/OpenWebBeans. In current camel-cdi component we support some basic features like scaning beans from registry (both by name and type). There is lots of features we need to implement to make support for CDI similar to existing Spring or Blueprint components. I've created an issue CAMEL-5422 few days ago to track all CDI issues. Charles created new component in JIRA. If you have any issues, please report them and link to CAMEL-5422.

Best regards,
Lukasz Dywicki
--
JBoss Switchyard - http://jboss.org/switchyard
Apache Karaf - http://karaf.apache.org

Wiadomość napisana przez Charles Moulliard w dniu 5 lip 2012, o godz. 08:34:

> This project has inspired the creation of camel-cdi project and it will be
> certainly used in camel 2.11 to improve what we have.
> 
> -----
> Apache Committer / Sr. Pr. Consultant at FuseSource.com
> Email: [hidden email]
> Twitter : @cmoulliard, @fusenews
> Blog : http://cmoulliard.blogspot.com
> --
> View this message in context: http://camel.465427.n5.nabble.com/CDI-and-Camel-tp5715507p5715514.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Re: CDI and Camel

Posted by Charles Moulliard <cm...@gmail.com>.
This project has inspired the creation of camel-cdi project and it will be
certainly used in camel 2.11 to improve what we have.

-----
Apache Committer / Sr. Pr. Consultant at FuseSource.com
Email: [hidden email]
Twitter : @cmoulliard, @fusenews
Blog : http://cmoulliard.blogspot.com
--
View this message in context: http://camel.465427.n5.nabble.com/CDI-and-Camel-tp5715507p5715514.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: CDI and Camel

Posted by Bruno Borges <br...@gmail.com>.
I think this project has a more complete implementation of an integration
between Camel and CDI: https://github.com/obergner/camelpe


*Bruno Borges*
(21) 7672-7099
*www.brunoborges.com*



On Thu, Jul 5, 2012 at 2:19 AM, Bruno Borges <br...@gmail.com> wrote:

> Guys, a few things about the new Camel-CDI component:
>
> 1) It seems the docs for the CDI component are not accurate: it links to
> some pages that are not available anymore. (like the GitHub links)
>
> 2) How can it inject a CdiCamelContext if it is not defined anywhere? (and
> this class doesn't have @Named)
>
>
>
> *Bruno Borges*
> (21) 7672-7099
> *www.brunoborges.com*
>
>

Re: CDI and Camel

Posted by Charles Moulliard <cm...@gmail.com>.
Hi Bruno,

Link has changed (https://github.com/cmoulliard/cdi-camel-example/). Thx to
provide me the info, I have updated the project in GitHub. 

By the way, I'm currently refactoring this GitHub project which could be
part in the future of camel project to provide examples + test cases about
deploying camel in CDI environment no matter if it is JavaSE or J2EE. 

I have created under this project a container folder containing
implementations for :
 
- Glassfish (J2EE) - but could also be used (this is WAR) to deploy project
in JBOSS, Geronimo, ...
- Weld (JavaSE) - Standalone JavaSE - CDI container is started and beans to
be injected are added next
- DeltaSpike (JavaSE) --> openwebbeans or weld. Allow to start a main App
discovering the CDI container and next injecting the beans)
- Karaf (OSGI) - will be based on weld-osgi work or OpenEJB/OpenWebbeans
using KarafEE

I will update documentation end of this week

Regarding to your second question, the CamelContext could be injected like
this :

https://github.com/cmoulliard/cdi-camel-example/blob/master/container/glassfish/src/main/java/org/fusesource/example/cdi/camel/glassfish/BootStrap.java

@Singleton
@Startup
public class BootStrap {

    Logger logger = LoggerFactory.getLogger(BootStrap.class);

    @Inject
    CdiCamelContext camelCtx;

    @Inject
    SimpleCamelRoute simpleRoute;

    @PostConstruct
    public void init() throws Exception {
            logger.info(">> Create CamelContext and register Camel Route.");

            // Define Timer URI
           
simpleRoute.setTimerUri("timer://simple?fixedRate=true&period=10s");

            // Add Camel Route
            camelCtx.addRoutes(simpleRoute);


Regards,

-----
Apache Committer / Sr. Pr. Consultant at FuseSource.com
Email: [hidden email]
Twitter : @cmoulliard, @fusenews
Blog : http://cmoulliard.blogspot.com
--
View this message in context: http://camel.465427.n5.nabble.com/CDI-and-Camel-tp5715507p5715513.html
Sent from the Camel - Users mailing list archive at Nabble.com.