tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@gmail.com>
Subject Re: Inject CDI Objects into MDB's
Date Wed, 09 Nov 2011 15:50:39 GMT

On Nov 8, 2011, at 10:41 PM, Romain Manni-Bucau wrote:

> Hi,
> 
> fixed on trunk (jira created here
> https://issues.apache.org/jira/browse/OPENEJB-1706 )

Excellent!  We should switch that to a "new feature" from bug (see below).

> the beta 1 was only web profile oriented so we didn't work on JMS for
> instance.

Right, and injection into MDBs is not actually a requirement and there are not tests for it
in the full TCK either.

But it's definitely something we should support.  We support @Inject constructors for servlets
for example and that isn't part of the specification or TCK either.


-David

> 
> 2011/11/9 khoehn <khoehn@etranscor.com>
> 
>> Hello,
>> 
>> I have a MDB and I want to Inject an object into it to perform some tasks.
>> When I run this in a test via openejb.embedded the CDI object is null.  Is
>> this functionality supported in OpenEJB?
>> 
>> OpenEJB version 4.0.0-beta-1
>> 
>> @MessageDriven(
>>   mappedName = "jms/DataMigrationQueue",
>>   messageListenerInterface=MessageListener.class,
>>   activationConfig = {
>>      @ActivationConfigProperty(propertyName = "destinationName",
>> propertyValue = "jms/DataMigrationQueue"),
>>      @ActivationConfigProperty(propertyName = "destinationType",
>> propertyValue = "javax.jms.Queue"),
>>      @ActivationConfigProperty(propertyName = "messageSelector",
>> propertyValue = "catalog = 'xxx' and table = 'xxx'")
>>   })
>> public class MigrationMessageListener implements MessageListener
>> {
>>   @Inject
>>   private MigrationService migrationService;
>> 
>>   @Override
>>   public void onMessage(Message message)
>>   {
>>       System.out.println(migrationService);
>>   }
>> }
>> 
>> Thank You,
>> -kurt
>> 
>> --
>> View this message in context:
>> http://openejb.979440.n4.nabble.com/Inject-CDI-Objects-into-MDB-s-tp4018481p4018481.html
>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>> 


Mime
View raw message