You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Charles <cw...@yahoo.com> on 2012/07/16 18:53:38 UTC

How to deploy Camel to EJB / J2EE container?

I have some Camel routes interacting with a 3rd EJB-based app.  Currently this is accomplished by 
acquiring a JMS topic via JNDI and starting the Camel context in a separate VM instance, 
i.e. running Camel as a regular Java application.  This is not really convenient - I'd like to 
package up Camel and the defined routes in an EJB for J2EE deployment because most of the 
application is implemented as EJB's and MBeans on JBoss.  
My concerns are:

Is it even possible?  I ask because I'm pretty sure Camel creates it's own threads and maybe 
uses ThreadLocal internally.  I'm no an EJB expert, but I understand that application code 
should not create it's own threads.  I wonder if this is true even in stateless session beans?

I already searched around and the only deployment options I've seen discussed are 
standalone (java app), Spring container and OSGI container - I have found nothing about 
J2EE deployment.   Any ideas?

Thanks,

-Charles

Re: How to deploy Camel to EJB / J2EE container?

Posted by Charles <cw...@yahoo.com>.
Romain,

If you're using a ServletContextListener, it sounds like you're deploying your Camel app in a web app.  As for CDI, a/k/a JSR-299, I have not heard of that before but upon looking, it just seems like a "JSRized" implementation of Spring Framework.   I was asking about deployment to J2EE and assumed EJB was my only option, but this CDI looks promising.  Since my project must use JBoss, I looked and there's a CDI implementation for JBoss, (which they call "Weld", which in turn, is part of their JSF implementation (called "Seam").  

http://docs.jboss.org/weld/reference/1.0.0/en-US/html/2.html


On the other hand, if you say you were able to deploy in the web tier and access container resources via JNDI - I think I'll just try that first.

Thanks,

-Charles

________________________________
From: Romain Manni-Bucau <rm...@gmail.com>
To: users@camel.apache.org; Charles <cw...@yahoo.com> 
Sent: Monday, July 16, 2012 1:32 PM
Subject: Re: How to deploy Camel to EJB / J2EE container?


Hi,

typically in J2EE or JEE without spring you use standalone like app: create you context manually and manage its lifecycle. You speak about J2EE so i guess you don't have CDI but as a side note with CDI there are some project taking it into account.

Personnally i used a servletcontextlistener to build-start/stop my context and used the jndiregistry to be able to get my ejbs.

- Romain



2012/7/16 Charles <cw...@yahoo.com>

I have some Camel routes interacting with a 3rd EJB-based app.  Currently this is accomplished by 
>acquiring a JMS topic via JNDI and starting the Camel context in a separate VM instance, 
>i.e. running Camel as a regular Java application.  This is not really convenient - I'd like to 
>package up Camel and the defined routes in an EJB for J2EE deployment because most of the 
>application is implemented as EJB's and MBeans on JBoss.  
>My concerns are:
>
>Is it even possible?  I ask because I'm pretty sure Camel creates it's own threads and maybe 
>uses ThreadLocal internally.  I'm no an EJB expert, but I understand that application code 
>should not create it's own threads.  I wonder if this is true even in stateless session beans?
>
>I already searched around and the only deployment options I've seen discussed are 
>standalone (java app), Spring container and OSGI container - I have found nothing about 
>J2EE deployment.   Any ideas?
>
>Thanks,
>
>-Charles
>

Re: How to deploy Camel to EJB / J2EE container?

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,

typically in J2EE or JEE without spring you use standalone like app: create
you context manually and manage its lifecycle. You speak about J2EE so i
guess you don't have CDI but as a side note with CDI there are some project
taking it into account.

Personnally i used a servletcontextlistener to build-start/stop my context
and used the jndiregistry to be able to get my ejbs.

- Romain


2012/7/16 Charles <cw...@yahoo.com>

> I have some Camel routes interacting with a 3rd EJB-based app.  Currently
> this is accomplished by
> acquiring a JMS topic via JNDI and starting the Camel context in a
> separate VM instance,
> i.e. running Camel as a regular Java application.  This is not really
> convenient - I'd like to
> package up Camel and the defined routes in an EJB for J2EE deployment
> because most of the
> application is implemented as EJB's and MBeans on JBoss.
> My concerns are:
>
> Is it even possible?  I ask because I'm pretty sure Camel creates it's own
> threads and maybe
> uses ThreadLocal internally.  I'm no an EJB expert, but I understand that
> application code
> should not create it's own threads.  I wonder if this is true even in
> stateless session beans?
>
> I already searched around and the only deployment options I've seen
> discussed are
> standalone (java app), Spring container and OSGI container - I have found
> nothing about
> J2EE deployment.   Any ideas?
>
> Thanks,
>
> -Charles
>