camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Moulliard <cmoulli...@gmail.com>
Subject Re: CDI and Camel
Date Thu, 05 Jul 2012 06:31:28 GMT
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.

Mime
View raw message