Lazy loading of MDB*s (Message Driven Beans)
As I'm just working on a huge BEA Migration to OC4J 10.1.2 (where we discover some nice BEA features) - we came through a nice challenge.
As you are able to specify the loading order of modules within EAR's in BEA (and specify howmany, or if any ejb should be created) - we need to develop (based on existing j2ee api) some mechanism to achieve this loading too.
Some days ago olaf published here the first part of it (Using a j2ee-application-client) to start your ejbs.
In our case MDB*s from another module rely on the fact that some base stuff is already initialized (which works fine in BEA, due to start-order, and instance creation). Both of these features are VERY container dependend (and are not specified in the j2ee spec) - so it was another time for searching in the j2ee toolbox.
Simple thing - big outcome :-)
Create your mdb, and specify in the oracle-specific deployment descriptor (orion-ejb-jar.xml) for min-instances the value 0 and for listener-threads the value 1 - this will cause lazy.loading (or better creation ) of the bean, as in general the mdb is attached to a queue or topic @ deployment time (and what wonder mdb.createejb() is called :-) )
After configuration of this, you'll notice that your bean's method createejb() and setContext(pContext) - are called the first time when the bean retrieves a message (due to the listener-thread setting). Voila.
Having questions? Feedback me on this entry Lazy init of MDB'S
0 Comments:
Post a Comment
<< Home