tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: Outbound resource injection in an ejb
Date Thu, 14 Jan 2010 00:35:37 GMT

On Jan 13, 2010, at 11:12 PM, Jason Russo wrote:

> Hi all,
>
> Previously, I created a message driven bean that can connect to a jms
> queue through an external provider (Tibco) using a jca resource  
> adapter.
> What I am trying to figure out is how I can write an ejb that can  
> post a
> message to this external queue.  Does openejb support the injection of
> such a resource and how can it be configured?  Thanks.

Anything declared as an outbound resource in the ra.xml should just be  
injectable via plain old @Resource.  The configuration in the ra.xml  
is what will be used, unless... and I wish there was an easier way to  
set this up, but...

You *can* just unzip all your resource adapter jars into the  
openejb.base/lib/ directory and install it as an OpenEJB service by  
giving it a service-jar.xml file.  Essentially, this is what we are  
doing under the covers anyway when you put your rar file in the ear.   
I wish we had some syntactic sugar for this but we don't.  I looked  
into it a bit ago and just didn't have time to finish.

The end result of rewrapping your rar with a service-jar.xml is that  
you can declare and configure the MDB container, the resource adapter,  
and outbound resources in the openejb.xml via <Container> and  
<Resource> tags.

Basically, you pack META-INF/service-jar.xml file into jar and put it  
into the openejb.base/lib/ directory.  It's not well documented as it  
isn't quite intended for typical use, but it did come up recently and  
there are some details available here:

  http://n4.nabble.com/How-do-I-configure-an-alternate-transaction-manager-tp980158p980159.html

Here is the service-jar.xml that contains the declarations for the  
ActiveMQ resource adapter and outbound resources:

   http://svn.apache.org/repos/asf/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb.embedded/service-jar.xml


-David


Mime
View raw message