users@glassfish.java.net

CDI events is not working with MDBs

From: <forums_at_java.net>
Date: Mon, 10 Oct 2011 06:26:51 -0500 (CDT)

I have a message driven bean that fires a CDI event when a message arrives.
The listener method is never invoked.

Is this a bug or there is something wrong with my configuration?

The code example:

 

@MessageDriven(mappedName = "jms/MyTopic", activationConfig = {

    @ActivationConfigProperty(propertyName = "acknowledgeMode",
propertyValue = "Auto-acknowledge"),

    @ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Topic"),

    @ActivationConfigProperty(propertyName = "subscriptionDurability",
propertyValue = "Durable"),

    @ActivationConfigProperty(propertyName = "clientId", propertyValue =
"BackgroundEventDispatcher"),

    @ActivationConfigProperty(propertyName = "subscriptionName",
propertyValue = "BackgroundEventDispatcher")

})

public class *BackgroundEventDispatcher *implements MessageListener {

    @Inject @Any

    private Event<String> eventBus;

    public BackgroundEventDispatcher() {

    }

    @Override

    public void onMessage(Message message) {

            eventBus.fire(event);

    }

}

 

@Named

@ApplicationScoped

public class *MainRoom *implements Serializable {

    public void eventFired(@Observes String event) {

        // Do something.

    }

}


--
[Message sent by forum member 'averri']
View Post: http://forums.java.net/node/851854