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: How to define a JCA connection pool / jndi address?
Date Thu, 20 Sep 2007 12:34:12 GMT

On Sep 20, 2007, at 2:02 AM, Ed Hillmann wrote:

> On 9/20/07, David Jencks <david_jencks@yahoo.com> wrote:
>> OK, you're right.  I opened https://issues.apache.org/jira/browse/
>> GERONIMO-3480.
>>
>> Meanwhile you will have to modify your ra.xml to list all the config
>> properties you want to use, and we don't complain if you don't set  
>> some.
> I can deal with that.  I just prefer not treating every property as
> mandatory.  One, because there doesn't seem to be a clean way to
> define a null value to the property.  Another reason, is because our
> DD would end up being rather large if all the optional properties
> required declaration ahead of time.

On the other hand my apparent misinterpretation of the spec means  
that all the MCF and RA properties you can configure are described in  
the ra.xml which I thought was the point of the ra.xml... live and  
learn.
>
>>
>> In geronimo you need to use a plan to deploy a resource adapter
>> instance, and that plan specifies the pooling parameters.  You can
>> deploy as many MCFs/pools as you want in one plan using the same
>> resource adapter.  There is no way to do this from the console at
>> this time.
>>
>> If you are still having trouble figuring out a working plan please
>> post what you have and some indication of the problems you are  
>> seeing.
>>
> I am.  This plan is the same plan that is used when deploying the RAR
> module, yes?
>
> This is what I have so far:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/ 
> connector-1.2">
>   <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/ 
> deployment-1.2">
>     <dep:moduleId>
>       <dep:groupId>com.intecbilling.singleview</dep:groupId>
>       <dep:artifactId>svConnector</dep:artifactId>
>       <dep:version>1.0</dep:version>
>       <dep:type>rar</dep:type>
>     </dep:moduleId>
>     <dep:dependencies>
>       <dep:dependency>
>         <dep:groupId>com.intecbilling.singleview</dep:groupId>
>         <dep:artifactId>enterprise-java-interface</dep:artifactId>
>         <dep:version>6.01.05.01</dep:version>
>         <dep:type>jar</dep:type>
>       </dep:dependency>
>     </dep:dependencies>
>     <dep:hidden-classes/>
>     <dep:non-overridable-classes/>
>   </dep:environment>
>   <resourceadapter>
>     <resourceadapter-instance>
>       <resourceadapter-name>Singl.eView Inbound Resource
> Adapter</resourceadapter-name>
>       <workmanager>
>         <gbean-link>DefaultWorkManager</gbean-link>
>       </workmanager>
>     </resourceadapter-instance>
>     <outbound-resourceadapter>
>       <connection-definition>
>         <connectionfactory- 
> interface>javax.resource.cci.ConnectionFactory</connectionfactory- 
> interface>
>         <connectiondefinition-instance>
>           <name>jca/SVConnector1</name>
>           <config-property-setting
> name="ServerName">wallaby</config-property-setting>
>           <config-property-setting
> name="PortNumber">10551</config-property-setting>
>           <config-property-setting
> name="UserName">tpsysadm</config-property-setting>
>           <config-property-setting
> name="Password">tpsysadm</config-property-setting>
>           <connectionmanager>
>             <single-pool>
>               <max-size>10</max-size>
>               <blocking-timeout-milliseconds>5000</blocking-timeout- 
> milliseconds>
>               <match-one/>
>             </single-pool>
>           </connectionmanager>
>         </connectiondefinition-instance>
>       </connection-definition>
>     </outbound-resourceadapter>
>   </resourceadapter>
> </connector>

That looks fine to me and if geronimo doesn't complain it looks fine  
to geronimo also :-)
>
> I guess, in this case, I was expecting to see "jca/svConnector1" in
> the JNDI tree of the server.  Simply because I didn't see anywhere
> else I was supposed to declare the JNDI address of the
> ConnectionFactory.

Geronimo doesn't rely on global jndi for much of anything.  In  
particular connectors aren't bound into global jndi  by default.  A  
javaee component only gets jndi access to a connection factory by a  
having a resource-ref in its spec dd (or an equivalent annotation).

>
> What I'm trying to do is this.  I have written an Inbound Adapters
> that, when its endpoint is being registered, will get a Connection
> using a JNDI address defined as part of it's ActivationSpec.  This
> connection will be used to handler incoming events.

So, I think you can make this work in geronimo but I'm not sure this  
is an ideal architecture unless you have a rather unusual EIS.  Most  
inbound adapters need a connection their entire life, not  
intermittently.  So there isn't a whole lot of point in getting the  
connection from the connection pool, since it isn't going to be  
reused by other clients- you mostly risk contention between inbound  
and outbound work.  Instead you might consider distributing the  
configurable properties between the ResourceAdapter, the MCF, and the  
activation spec so the inbound adapter has enough information  
directly to create the connection from the resource adapter instance  
and activation spec properties without the overhead of getting a  
connection from a pool.  Among other things this might simplify  
configuration of your adapter for those who e.g. only want to  use it  
inbound -- they won't need to set up a pool of outbound connections  
that they aren't going to use themselves.

>
> So, in the scope of the jca-plan.xml file, is this two
> <resourceadapter> nodes: one for the connection pool (containing the
> <outbound-resourceadapter> element), and a second for the
> <resourceadapter-instance> (which contains the JNDI address of the
> first entry in the plan).
>
> Or can this be described using a single <resourceadapter> node?

You only need one resource adapter instance AFAICT.  The activation  
spec is configured with  the MDB using the inbound adapter.

Since geronimo doesn't use global jndi for any of this, you have to  
get the connection factory your inbound adapter needs available to it  
by using a resource-ref in the mdb that will be receiving inbound calls.

So if you have a resource-ref for your mdb that starts out

<resource-ref>
    <resource-ref-name>jca/SVConnector1</resource-ref-name>
...

the activation spec jndi property would be java:comp/env/jca/ 
SVConnector1

As long as you include the rar configuration as a dependency of your  
application (i.e. the moduleId from your plan appears in the  
dependencies in the environment element of the application plan) you  
shouldn't need any more configuration for geronimo to be able to find  
the right connection factory.

>
> Less importantly, are there any plans to make this a little easier via
> the Admin Console?  I don't want to whine.  But I can, if you like...
> :)

What would you like to see?  Some way of configuring all the  
properties on the resource adapter and MCF instances?  That would be  
nice but I'm not sure anyone is panting to work on it soon.  Maybe a  
more realistic near term goal would be some instructions on the  
wiki...  You are very welcome to contribute :-)

Hope this helps
david jencks

>
> Thanks,
> Ed


Mime
View raw message