MDB working
Hi,
I am using MDBs in conjunction with JMS queues in an application. I have a basic question. I know MDBs achieve parallel processing. But how?
Are different instances of the MDB created? Or are there different threads?
Also how do I get a handle to each thread/instance? Does any app server allow us to do it?
# 1
Parallel processing in MDBs is achieved in much the same way as in Stateless Session Beans.
Each message sent to an MDB is handled by either a pooled or newly created bean instance on
a separate thread. The container guarantees that there are never two messages handled by the
same bean instance at the same time.
In the EJB programming model, the application never directly manipulates invocation threads or
bean instances. What is it that you'd like to do in your application?
ksaksa at 2007-7-29 12:49:59 >

# 2
Hi,
Thanks.
This is my scenario.
I have a bunch of incoming messages in the JMS queue. I presume there will be multiple threads processing these messages. Now based on the property of one of these messages, I would like to make all other threads wait till this thread completes.
So basically based on the message dequeued I would like to prioritize a particular thread and block all other threads(MDBs).
Is there a way to achieve this?
# 3
No, there's no support for this in the MDB programming model.Some MDB containers will allow
the deployer to configure the maximum number of concurrent messages allowed. Setting that
value to 1 would effectively serialize the message stream. However, the problem with that is you
lose the performance advantage of concurrent processing even when you could benefit from it.
You're better off using a database and transactions for synchronization.
--ken
ksaksa at 2007-7-29 12:49:59 >
