I'm sure I should have learned this in MDB 101, but I'll ask here
anyway.

I have an MDB that reads incoming messages, does a bunch of work, and
then writes data to another outgoing JMS Queue.

As the load increases, Geronimo will create multiple instances of the
MDB and I was getting exceptions after about the 10th instance, because
I could not get enough outgoing Queue connections.

Originally each MDB was looking up the outgoing connection factory and
queue and creating a connection,session,producer in onMessage().  

But since I was getting the above error, I modified it to get the
outgoing  connection factory,queue and connection in ejbCreate() and
holding onto those is *static* variables, so all instances of the MDB
shared the same connection.
The onMessage() still gets it's own session and producer.

That solved my problem, but I'm not sure it is "right".

It is OK to share the factory/queue/connection across multiple instances
of an MDB?

 

Reply via email to