6 Replies Latest reply on Nov 22, 2011 8:50 PM by Muhammed Aamir Cutlery

    Working MDB example in JBoss 7.0.1?

    Andrew Regan Newbie

      Here's an EJB3 MDB that used to work for me in JBoss 5.1:

       

      {code:java}    @TransactionAttribute( TransactionAttributeType.NOT_SUPPORTED )

          @org.jboss.ejb3.annotation.Depends("jboss.messaging.destination:service=Topic,name=IncomingArticleNotifications")

          @MessageDriven(

              activationConfig = {

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

                  @ActivationConfigProperty( propertyName="destination", propertyValue="topic/IncomingArticleNotificationsDest"),

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

                  @ActivationConfigProperty( propertyName="messageSelector", propertyValue ="type='IncomingArticleNotification'")

              }

          )

          public class IncomingArticleHandler implements MessageListener

          {

              [ ... ]

          }{code}

       

      Try as I might, I can't migrate this to JBoss 7.0.1. JMS is set up OK, and I can publish to the destination OK (from my main JAR), but my EJB listener just isn't listening. I get no deploy or runtime errors for my EJB / WAR / EAR:

       

      {code}    01:02:40,600 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) Starting deployment of "product-ear-1.0-SNAPSHOT.ear"

          01:02:41,752 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) Starting deployment of "product-ejb-1.0-SNAPSHOT.jar"

          01:02:41,753 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) Starting deployment of "product.war"{code}

       

      I've also fixed the JNDI names, as per instructions, so here's what I have now:

       

      {code:java}    // Ignore for now: @TransactionAttribute( TransactionAttributeType.NOT_SUPPORTED )

          // Ignore for now: @ResourceAdapter("ejb3-rar.rar")

          @MessageDriven(

              activationConfig = {

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

                  @ActivationConfigProperty( propertyName="destination", propertyValue="java:/topic/IncomingArticleNotificationsDest"),    // updated

                  // Ignore for now: @ActivationConfigProperty( propertyName="subscriptionDurability", propertyValue="Durable")

                  // Ignore for now: @ActivationConfigProperty( propertyName="messageSelector", propertyValue ="type='IncomingArticleNotification'")

              }

          )

          public class IncomingArticleHandler implements MessageListener

          {

              [ ... ]

          }{code}

       

      Setting all loggers to ALL before deploying reveals that the only time my MDB classes are mentioned is when the

      org.jboss.vfs.util.SuffixMatchFilter sees them - that can't be good.

       

      I've been following the issue of MDB support since 7.0.0 (https://issues.jboss.org/browse/AS7-455) and have read through dozens of JIRAs, not to mention the migration guide, EJB3 docs and so on, but I'm left confused. I know MDBs *should* work in 7.0.1, but is the above doable? I think mine is quite a simple case, so does anyone have a simple working example, a single document that states exactly what does / doesn't work in 7.0.1, or a migration guide?

       

      I can deploy a dummy {code:java}@Stateless{code} with no problems, but no combination of {code:java}@MessageDriven{code} / {code:java}@ActivationConfigProperty{code} has had any effect at all (bodging the destinationType to `javax.jms.XXX` produces no errors!). I've tried setting the destination property to all possible JNDI combinations.

       

      I've checked my 'standalone.xml' against 'standalone-preview.xml' and there are no substantial differences.

      .