"[EMAIL PROTECTED]" wrote : No, they have no relation. You can create an mbean 
that interacts with an ejb3 component and visa-versa, but it makes no sense to 
expose an ejb3 bean via jmx because the lifecycles do not match.

Scott, first off, thanks for the response.  I would like to explore this though 
a little bit further (hoping you see this!).

I agree that the on face value, the lifecycles don't exactly match but then 
riddle me this:

What if an EJB3 stateless bean acted like a service (sorta like the custom 
@Service notation that JBoss provides but not exactly) and I want to instrument 
this object?  Pretend for a moment its possible to start and stop the service 
as well as other lifecycle management like stuff (not exactly creation and 
deletion but more like turn on/turn off service flags).  I also want to be able 
to lookup these beans over some sort of domain namespace (granted I could walk 
through JNDI space but that seems clunky to me, the queryBeans() functionality 
is what I really want).

I suppose what your getting at is that the lifecycle of an EJB3 object is 
defined by the EJB3 deployer and that as a developer I have no real control 
minus the initial lifecycle callbacks defined by the spec (@PostConstruct and 
friends). i.e defining lifecycle callbacks on a bean via JMX doesn't make sense 
here.  Alright but what if I want my EJB3 to cause notifications to be 
generated?  This seems to be very JMX like and at least to me, not unreasonable.

Maybe the better approach then is to construct a JMX MBean with the EJB3  
reference in it so I can get best of both worlds?  I can define my own service 
lifecycle but use EJB3 for the core logic.  Is that a bad idea?  This design 
pattern adheres to the separate use of JMX and EJB3.  Or is there no synergy 
whatsoever between JMX and EJB3 (btw, the JMX spec seems to support the claim 
that a managed object can be an EJB though Scott I will fully concede if this 
was just spec/theory and not really practical).

Final note, if your going to ask why use EJB3 at all?  Well, because I thought 
it would provide a nice IoC model, allow for state, and is more tightly coupled 
with other services (persistence comes to mind) than a custom object.

Any feedback would be much appreciated (especially if I'm completely going down 
the wrong path)!  :-)!

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3932653#3932653

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3932653


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to