geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: Sharing resources in an MDB
Date Wed, 25 Apr 2007 15:35:59 GMT

On Apr 25, 2007, at 8:14 AM, ananner wrote:

>
> I also have a requirement to limit a certain MDB to a maximum of one
> instance, but I am a bit confused as to your response.  Are you  
> saying that
> I should put a pool size limit on the <outbound-resourceadapter> which
> defines the Connection Factory that my MDB subscribes to?

The ResourceAdapter instance gets a BootstrapContext instance when  
its started, and the BootstrapContext basically includes a thread  
pool.  So if you give it a thread pool with only one thread....

In geronimo you specify which thread pool to use with this part:

             <workmanager>
                 <gbean-link>DefaultWorkManager</gbean-link>
             </workmanager>


So you could include a thread pool:

     <gbean name="SingleThreadPool"  
class="org.apache.geronimo.pool.ThreadPool">
         <attribute name="keepAliveTime">5000</attribute>
         <attribute name="poolSize">1</attribute>
         <attribute name="poolName"> SingleThreadPool </attribute>
     </gbean>

and use it:

             <workmanager>
                 <gbean-link>SingleWorkManager</gbean-link>
             </workmanager>

This is a horrible solution because you have to set up a resource  
adapter instance for each mdb that needs its size limited in this  
way.  Hopefully there's a way to restrict the mdb pool size that I  
don't know about.

BTW, I recall hearing James Strachan talk about message groups.  If  
your requirements are that you get sets of messages that, within the  
set, must be processed in order rather than all messages must be  
processed in order you might be able to introduce some concurrency by  
using message groups.


Hope this helps
david jencks

>
> Thanks,
> Aman
>
>
> djencks wrote:
>>
>>
>> It might possibly work for activemq if you don't use any
>> transactions, but if you use transactions I would expect it to
>> completely break and give pretty random behavior.  I don't think
>> there's any reason to expect it to work even without transactions.
>>
>> I have trouble keeping all the places you can configure sizes
>> straight, but one way to limit the number of active mdbs is to give
>> the inbound resource adapter its own thread pool and limit that
>> size.  I think there's a more direct way but don't recall what it is.
>>
>> If the number of outbound connections is at least the number of mdbs
>> I would expect you wouldn't run into problems.
>>
>> Maybe someone with more actual experience can give some more informed
>> advice.
>>
>> thanks
>> david jencks
>>
>>>
>>>
>>>
>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Sharing- 
> resources-in-an-MDB-tf3412013s134.html#a10182882
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>


Mime
View raw message