You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by um <um...@mib.com> on 2013/10/30 19:18:15 UTC

MDB being instantiated on every message

I am using MDBs deployed on tomEE that reads from websphere MQ. I have
configured and installed the websphere MQ resource adapters. From my tests,
I am finding that MDBs are instantiated and destroyed for every message and
the connection pool settings defined in tomee and ejb-jar are  not used at
all. Is this the way tomEE handles MDBs?
Thanks



--
View this message in context: http://openejb.979440.n4.nabble.com/MDB-being-instantiated-on-every-message-tp4665830.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: MDB being instantiated on every message

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Not really, this is not 1-1 ejb pool is hidden so you can get 5 and 10 IMO
Le 14 nov. 2013 20:11, "um" <um...@mib.com> a écrit :

> How would the following work?
>
> wmqra activation spec specifies maxPoolDepth as follows (in ejb-jar)
>
>  <activation-config-property>
>
>
> <activation-config-property-name>maxPoolDepth</activation-config-property-name>
>
> <activation-config-property-value>5</activation-config-property-value>
>  </activation-config-property>
>
> tomee.xml has the following -
>   instanceLimit=10
>
> I am expecting that there would be 5 instances of the MDB based on
> maxPoolDepth
>
> This is my understanding from what you have said - the container provides
> the resource adapter with the  factory for creation of message endpoint
> instances. When a message arrives, the resource adapter determines the  MDB
> and using the MesageEndpointFactory creates an MDB instance by  invoking
> the
> endpoint creation methods on the factory. But what makes the decision of
> creating new instance as opposed to using existing one. What makes the
> decision to remove the instance after every onMessage()?
>
> Thanks
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/MDB-being-instantiated-on-every-message-tp4665830p4666181.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: MDB being instantiated on every message

Posted by um <um...@mib.com>.
How would the following work?

wmqra activation spec specifies maxPoolDepth as follows (in ejb-jar)

 <activation-config-property>
             
<activation-config-property-name>maxPoolDepth</activation-config-property-name>
             
<activation-config-property-value>5</activation-config-property-value>
 </activation-config-property>

tomee.xml has the following -
  instanceLimit=10

I am expecting that there would be 5 instances of the MDB based on
maxPoolDepth 

This is my understanding from what you have said - the container provides
the resource adapter with the  factory for creation of message endpoint
instances. When a message arrives, the resource adapter determines the  MDB
and using the MesageEndpointFactory creates an MDB instance by  invoking the
endpoint creation methods on the factory. But what makes the decision of
creating new instance as opposed to using existing one. What makes the
decision to remove the instance after every onMessage()?

Thanks




--
View this message in context: http://openejb.979440.n4.nabble.com/MDB-being-instantiated-on-every-message-tp4665830p4666181.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: MDB being instantiated on every message

Posted by Romain Manni-Bucau <rm...@gmail.com>.
The resource adapter needs to call endpoint factory then behind it the
container respect mdb container config, not the opposite.
Le 14 nov. 2013 19:10, "um" <um...@mib.com> a écrit :

> The instanceLimit sets the maximum MDB instances. So, I would assume when
> this limit is met, new instances will not be created and an instance will
> be
> picked from the pool. I have set the instanceLimit to 10.
> But what I am observing is that when I use the websphere mq resource
> adapter, this number does not matter. An MDB is created every time.
>
> Does the container delegate that (message endpoint activation/deactivation)
> to the resource adapter? If yes, then would the resource adapter be
> responsible for the endpoint instances?
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/MDB-being-instantiated-on-every-message-tp4665830p4666178.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: MDB being instantiated on every message

Posted by um <um...@mib.com>.
The instanceLimit sets the maximum MDB instances. So, I would assume when
this limit is met, new instances will not be created and an instance will be
picked from the pool. I have set the instanceLimit to 10. 
But what I am observing is that when I use the websphere mq resource
adapter, this number does not matter. An MDB is created every time. 

Does the container delegate that (message endpoint activation/deactivation)
to the resource adapter? If yes, then would the resource adapter be
responsible for the endpoint instances?



--
View this message in context: http://openejb.979440.n4.nabble.com/MDB-being-instantiated-on-every-message-tp4665830p4666178.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: MDB being instantiated on every message

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Yes, we rely on InstanceLimit of mdb container iirc
Le 14 nov. 2013 13:45, "um" <um...@mib.com> a écrit :

> IBM support has responded with the following -
>
> /Here, level 2's understanding is correct i.e "maxPoolDepth" is the
> maximum number of server sessions in the server session pool used by the
> connection consumer, which controls the number of MDB instances i.e the
> Maximum number of MDB instances that can be instantiated is equal to the
> value configured in  "maxPoolDepth" property.
>
> It is the responsibility of the EJB Container to either create a new
> instance of the message-driven bean, or get an instance of the
> message-driven bean from an internal pool not the WebSphere MQ  Resource
> Adapter.
> /
>
> So, my question is - is the maxPoolDepth property being ignored by tomEE.
> As
> I said in my I am seeing this behavior when I use websphere mq resource
> adapter.
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/MDB-being-instantiated-on-every-message-tp4665830p4666167.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: MDB being instantiated on every message

Posted by um <um...@mib.com>.
IBM support has responded with the following -

/Here, level 2's understanding is correct i.e "maxPoolDepth" is the      
maximum number of server sessions in the server session pool used by the
connection consumer, which controls the number of MDB instances i.e the
Maximum number of MDB instances that can be instantiated is equal to the
value configured in  "maxPoolDepth" property.                           
                                                                        
It is the responsibility of the EJB Container to either create a new    
instance of the message-driven bean, or get an instance of the          
message-driven bean from an internal pool not the WebSphere MQ  Resource
Adapter.                                                                
/

So, my question is - is the maxPoolDepth property being ignored by tomEE. As
I said in my I am seeing this behavior when I use websphere mq resource
adapter.



--
View this message in context: http://openejb.979440.n4.nabble.com/MDB-being-instantiated-on-every-message-tp4665830p4666167.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: MDB being instantiated on every message

Posted by um <um...@mib.com>.
Used the same MDB against the active MQ (only changing the configuration to
use active mq spec). Behavior is correct, MDBs instantiated, used from pool.
So, it must be a resource adapter issue.
Thanks



--
View this message in context: http://openejb.979440.n4.nabble.com/MDB-being-instantiated-on-every-message-tp4665830p4665871.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: MDB being instantiated on every message

Posted by Romain Manni-Bucau <rm...@gmail.com>.
if the MDB is called through its proxy we create an instance by
invocation otherwise we limit the instance number to InstanceLimit
config. This last case should be the one used by RA. That's the RA
which handle the endpoint factory in
javax.resource.spi.ResourceAdapter#endpointActivation
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2013/10/31 um <um...@mib.com>:
> Thank you!
> I had put in a support request with IBM and have been told it may be a
> problem with how tomEE handles the definitions in the activation spec. The
> only thing is, the wmqra has its own definitions to be used for
> maxConnections, sessions etc. So, not sure what is happening....
>
>
>
> --
> View this message in context: http://openejb.979440.n4.nabble.com/MDB-being-instantiated-on-every-message-tp4665830p4665855.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: MDB being instantiated on every message

Posted by um <um...@mib.com>.
Thank you! 
I had put in a support request with IBM and have been told it may be a
problem with how tomEE handles the definitions in the activation spec. The
only thing is, the wmqra has its own definitions to be used for
maxConnections, sessions etc. So, not sure what is happening....



--
View this message in context: http://openejb.979440.n4.nabble.com/MDB-being-instantiated-on-every-message-tp4665830p4665855.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: MDB being instantiated on every message

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

Normally no, can be related to the resource adapter BTW
Le 30 oct. 2013 20:29, "um" <um...@mib.com> a écrit :

> I am using MDBs deployed on tomEE that reads from websphere MQ. I have
> configured and installed the websphere MQ resource adapters. From my tests,
> I am finding that MDBs are instantiated and destroyed for every message and
> the connection pool settings defined in tomee and ejb-jar are  not used at
> all. Is this the way tomEE handles MDBs?
> Thanks
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/MDB-being-instantiated-on-every-message-tp4665830.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>