users@glassfish.java.net

Re: MessageDrivenBean not triggered

From: Cheng Fang <Cheng.Fang_at_Sun.COM>
Date: Sun, 22 Oct 2006 16:45:42 -0400

Hi Alexis,
>
> I post successfully (i.e. without exceptions) some messages to a topic.
> However my MDB is not triggered and that's my problem.
>
> How can check that my MDB is "deployed"?
Open domains/domain1/logs/server.log, and check if there is any error
deploying or loading MDB. Refer to EJB 3 spec section 5.4.13 for
allowed annotations for MDB.

In your example, if you don't have ejb-jar.xml to complement your
annotations, metadata are not complete. At least the jms destination
type is missing.

The following is my example MDB, using annotations alone without
ejb-jar.xml:

@MessageDriven(mappedName="jms/my-topic"
    activationConfig = {
    @ActivationConfigProperty(propertyName="destinationType",
                              propertyValue="javax.jms.Topic"),
    @ActivationConfigProperty(propertyName="acknowledgeMode",
                              propertyValue="Dups-ok-acknowledge"),
    @ActivationConfigProperty(propertyName="subscriptionDurability",
                              propertyValue="NonDurable"),
    @ActivationConfigProperty(propertyName="messageSelector",
propertyValue="foo='abc' AND bar NOT BETWEEN 2 AND 3456")
})

@TransactionManagement(TransactionManagementType.BEAN)
public class MyMDB extends MyMDBBase
        implements MessageListener {

Note that not all annotations are required in my example. Check ejb-3
schema for details (glassfish.home/lib/schemas/ejb-jar_3.xsd and
javaee_5.xsd).


-cheng
> I have some doubts about the annotations set on my MDB, where can I
> find out a complete list off the allowed annotation (especially the
> @ActivationConfigProperty)?
>
> Thanks in advance for your help.
>
> Alexis
>
> ps: I use glassfish-v2-b22 and here is my MDB source code:
>
> @MessageDriven(mappedName = "jms/topic/order", activationConfig = {
> @ActivationConfigProperty(propertyName = "subscriptionDurability",
> propertyValue = "Durable")
> , @ActivationConfigProperty(propertyName = "clientId",
> propertyValue = "MyID")
> , @ActivationConfigProperty(propertyName = "subscriptionName",
> propertyValue = "EmailSender")
> }
> )
> public class EmailSenderBean implements MessageListener{
> ....
> }