tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Gallimore <jonathan.gallim...@gmail.com>
Subject Re: Resource adapter - Connection - Pooling parameters
Date Fri, 09 Mar 2018 19:05:01 GMT
If you're deploying a rar in an EAR file, then I believe you need to use
system.properties to provide these settings, as TomEE will create the
resources based on what is in the Rar's ra.xml.

Another option is to include the jars from the rar directly in the ear
file, and then you can define the resources for the connection factory etc
in resources.xml.

I'll dig out an example in about an hour's time.

It would be a cool feature enhancement to be able to configure these
resources defined in the rar from resources.xml. I'll see if I can provide
that enhancement. I won't be able to do it straight away as my schedule is
a bit full - possibly next week. Alternatively, I'm happy to give some
pointers if someone else wants to have a go.

I'm not sure if you can specify system properties within your app - I'll
check.

Jon

On 9 Mar 2018 18:40, "jeankst" <jean.kon-sun-tack@nielsen.com> wrote:

> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message