[jboss-as7-dev] How would you typically consume an MSC service from a JEE deployment?

Thomas Diesler thomas.diesler at jboss.com
Tue Mar 29 17:38:24 EDT 2011


Have a look at the JNDI or Transaction integration. Basically these 
subsystems register aliases with the FQN of the interfaces they 
implement. The OSGi ServerManagerPlugin looks for these aliases and 
makes them visible through the OSGi service API.

Seeing a service through the OSGi service API does not mean you can use 
it. The consumer must have a wire to the provider of the service 
interface. If module that provides the interface must be registered with 
the OSGi resolver or the interface package must be part of the defined 
system packages. The latter breaks modularity of course (i.e. you can 
only have one version of that interface)

-thomas

On 03/29/2011 10:05 AM, David Bosschaert wrote:
> On 28/03/2011 22:59, Stuart Douglas wrote:
>> On 29/03/2011, at 8:00 AM, David M. Lloyd wrote
>>> On 03/28/2011 12:04 PM, Carlo de Wolf wrote:
>>>> On 03/28/2011 03:55 PM, David M. Lloyd wrote:
>>>>> On 03/28/2011 06:17 AM, David Bosschaert wrote:
>>>>>> Hi all,
>>>>>>
>>>>>> Just trying to figure out how an end user would typically consume an MSC
>>>>>> service from a JEE deployment such as a Servlet or EJB...
>>>>>>
>>>>>> How do we expect our customer to consume MSC services? (In my case the
>>>>>> MSC service is registered through the OSGi layer...)
>>>>>> I guess the ideal way would be through some sort of injection...
>>>>> *If* we do this, and I'm not saying we will, the best way would be to
>>>>> use the EE injection facilities. In other words, use @Resource or a
>>>>> resource-env-ref with maybe some customized mappedName attribute to
>>>>> designate the service - or perhaps a completely different annotation or
>>>>> descriptor altogether. This would incidentally be compatible with our
>>>>> existing EE injection system which uses MSC services anyway for setting
>>>>> up dependencies.
>>>> It would probably make more sense to let it coming in via @Inject.
>>> It's possible, however I am not sure whether we have the capability to
>>> perform CDI injection from MSC services.
>> It would not be to hard from a technical perspective, if this is what we decide to do.
>>
> Yes, that would be nice!
>
> And how about the reverse? Are we registering MSC services for EJBs or
> CDI beans already? That would allow them to be consumed from another
> layer that integrates at the MSC level - like an OSGi Bundle...
>
> Cheers,
>
> David
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev

-- 
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thomas Diesler
JBoss OSGi Lead
JBoss, a division of Red Hat
xxxxxxxxxxxxxxxxxxxxxxxxxxxx




More information about the jboss-as7-dev mailing list