[jboss-as7-dev] How to access a AS7 service from a deployed archive?

Jason Greene jason.greene at redhat.com
Thu Sep 20 12:39:19 EDT 2012


There really is no portable way to get at TransactionManager. However you should be able to do it from a rar using a jndi lookup on java:/TransactionManager or java:jboss/TransactionManager. IIRC the service dependency isn't a strict requirement at that stage. 

Otherwise to get at the ServiceContainer you should be able to use a ServiceActivator in the RAR (requires a META-INF/services/* entry).

BTW whats the main use case of this? The ability to use a different version of a hornetq client?

Looking at the forums links it seems we need to fix a few things in our subsystem configuration. Is there a way we could not require a running server to configure the pooled connection factory?

On Sep 20, 2012, at 11:09 AM, Brian Stansberry <brian.stansberry at redhat.com> wrote:

> I'm pretty much a noob when it comes to this RA, but this sounds 
> architecturally odd to me.
> 
> If an RA needs access to container services, aren't there spec defined 
> ways by which that access is obtained? If someone else wrote an RA, how 
> would they solve this problem? If this RA were deployed in Glassfish, 
> how would it do it?
> 
> I can see how if the subsystem installs the RA it could use an alternate 
> non-spec mechanism of finding services, but it feels odd if there is a 
> requirement to use those mechanisms for a deployment.
> 
> On 9/20/12 10:44 AM, Jeff Mesnil wrote:
>> Hi,
>> 
>> I'm working on making the HornetQ RA deployable in AS7 standalone (ie without a running HornetQ server) to be able to consume
>> messages from a remote JMS server[1].
>> 
>> The HornetQ RA requires access to the app server transaction manager to be fully functional[2].
>> 
>> I deploy the RA in standalone/deployments/ directory, the RA is started and it calls a class in the AS7 module
>> org.jboss.as.messaging which is in charge to locate the TM[3].
>> 
>> However this class code has a reference on the service container to be able to get the TxnService.
>> This was working when the RA is instantiated by the messaging subsystem. But when the RA is deployed, the container reference is
>> null.
>> 
>> My question is: in my case (a deployed archive that calls a AS7 module), is there a way to get a reference to the
>> ServiceContainer deploying the archive? Does it even make sense to do that this way?
>> Once I got it, I should be able to get the transaction manager service.
>> 
>> thanks,
>> jeff
>> 
>> [1] https://issues.jboss.org/browse/AS7-5483
>> [2] https://community.jboss.org/message/760644
>> [3]
>> https://github.com/jbossas/jboss-as/blob/master/messaging/src/main/java/org/jboss/as/messaging/jms/TransactionManagerLocator.java
>> 
>> 
> 
> 
> -- 
> Brian Stansberry
> Principal Software Engineer
> JBoss by Red Hat
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev




More information about the jboss-as7-dev mailing list