tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeankst <jean.kon-sun-t...@nielsen.com>
Subject Resource adapter - Connection - Pooling parameters
Date Fri, 09 Mar 2018 18:40:12 GMT
Hi all, 

We moving from Weblogic to TomEE and deploying with a RAR within an EAR. 
Here is what I got to work:

In ra.xml: 

  <resourceadapter id="MyResourceAdapter"> 
    <resourceadapter-class>foo.bar.MyResourceAdapter</resourceadapter-class> 
    <outbound-resourceadapter> 
      <connection-definition id="MyConnectionFactory1"> 
        
<managedconnectionfactory-class>foo.bar.ManagedConnectionFactory</managedconnectionfactory-class>

        <config-property> 
          <config-property-name>ServerName</config-property-name> 
          <config-property-type>java.lang.String</config-property-type> 
          <config-property-value>server001</config-property-value> 
        </config-property> 
        ... 
      </connection-definition> 
      <connection-definition id="MyConnectionFactory2"> 
        
<managedconnectionfactory-class>foo.bar.ManagedConnectionFactory</managedconnectionfactory-class>

        <config-property> 
          <config-property-name>ServerName</config-property-name> 
          <config-property-type>java.lang.String</config-property-type> 
          <config-property-value>server002</config-property-value> 
        </config-property> 
        ... 
      </connection-definition> 
      ...         
    </outbound-resourceadapter> 
  </resourceadapter> 

On TomEE startup, in the logs, I can see: 

  INFO [main]
org.apache.openejb.config.ConfigurationFactory.configureService Configuring
Service(id=MyResourceAdapter, type=Resource, provider-id=MyResourceAdapter) 
  INFO [main]
org.apache.openejb.config.ConfigurationFactory.configureService Configuring
Service(id=MyConnectionFactory1, type=Resource,
provider-id=MyConnectionFactory1) 
  INFO [main]
org.apache.openejb.config.ConfigurationFactory.configureService Configuring
Service(id=MyConnectionFactory2, type=Resource,
provider-id=MyConnectionFactory2) 
  
So in a container managed bean, I use: 

  @Resource(name = "MyConnectionFactory1", authenticationType =
Resource.AuthenticationType.APPLICATION, shareable = true) 
  private ConnectionFactory myFirstConnectionFactory; 

  @Resource(name = "MyConnectionFactory2", authenticationType =
Resource.AuthenticationType.APPLICATION, shareable = true) 
  private ConnectionFactory mySecondConnectionFactory; 

In /conf/system.properties, I set pooling parameters as: 

  MyResourceAdapter.threadPoolSize=7 

  MyConnectionFactory1.pooling=true 
  MyConnectionFactory1.poolMinSize=0 
  MyConnectionFactory1.poolMaxSize=3 
  MyConnectionFactory1.connectionMaxWaitTime=3 seconds 
  MyConnectionFactory1.connectionMaxIdleTime=1 minutes 

  MyConnectionFactory2.pooling=true 
  MyConnectionFactory2.poolMinSize=1 
  MyConnectionFactory2.poolMaxSize=2 
  MyConnectionFactory2.connectionMaxWaitTime=5 seconds 
  MyConnectionFactory2.connectionMaxIdleTime=10 seconds 

So what I understood so far:

  - For Weblogic only a connection-definition is in ra.xml and
connection-instance(s) are in weblogic-ra.xml with the actual parameters and
pooling settings
  - For TomEE all connections (and their parameters) are defined in the sole
ra.xml; pooling (pooling=true by default) is however set in
system.properties

Questions: 

  Is there a way do have those parameters embedded in the application EAR?
(instead of having to change the system.properties of the TomEE instance) 
  Is this possible using a resources.xml file? if so, what would be the
syntax to use according to the sample above? 

Thanks, 
Jean. 




--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html

Mime
View raw message