Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

to use an EJB or not?  RSS feed

 
Neil Goldsmith
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a system where MDB's receive queue messages and pass them to session beans for processing (call these router beans).
The router beans get information from the message about all the actions it needs to perform to satisfy the request. Now these actions are totally customized, but adhere to a common interface and represent classes independent of the router. All the router bean needs to know is how to instantiate them and to call the execute() method for each one. These actions are dynamically added to the system at any time.
I'm wondering about these action objects. I'm not sure if we want to require they be session beans themselves or simply java classes. What might be the benefits or liabilities to going in either direction with the action objects? This is obviously strictly from a theoretical standpoint on why EJB's over just regular classes when called from within an EJB.
 
Steve Chernyak
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The right answer:
It depends
My opinion:
Why not both? The message sent to the mdb could also contain instantiation instruction, this instruction could be passed to the factory that is responsible for instantiating the action class.
The benefits of using EJBs over regular classes are:
You make the container manage the instances of your action class.
It will be easier to dynamicaly add/modify the actions dynamically (not sure if you have this solved for regular classes)

security
tx awareness
blah
blah
blah
Im sure there are more but I can't think of any right now.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!