aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes calling SLSB from MDB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "calling SLSB from MDB" Watch "calling SLSB from MDB" New topic
Author

calling SLSB from MDB

manish ahuja
Ranch Hand

Joined: Oct 23, 2003
Posts: 312
Hi All

Currently I have a MDB which listens to a Topic. The moment it recieves a message it needs to invoke the business logic methods encapsulated in Stateless Session Beans.

Should i write all the SLSB access code in MDB's onMessage method or should i keep all access code in a separate class & then create an instance of the this class in the MDB & invoke the method which encapsulates all the access code.

Do let me know which would be a better approach

Thanks

Manish
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
This is totally an architectural issue, which people around here would only be guessing at since we don't know the issues surrounding your application. Basically, is there some reason why you need to de-couple your MDB from your SLSB? If so, go for it. If not, why are you bothering? Each approach has merit within different contexts.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
I would go with the second approach, since it has a lot of OO design value. You might consider implementing a Service Locator that could be reused throughout your application as well.


I think, therefore I exist -- Rene Descartes
david lightman
Ranch Hand

Joined: Nov 03, 2004
Posts: 82
excellent advise on using the ServiceLocator. I have MDB's that eventually call SB using this method.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: calling SLSB from MDB