10 Replies Latest reply on Oct 26, 2006 5:33 AM by Goran Ehrsson

    Durable Subscriber Annotations for MDB using EJB3

    David Small Newbie

      Can someone pass on to me the annotations that I need to specify to make an MDB a durable subscriber? I've looked through WIKI and the forums and have not found anything.

      Thanks

        • 1. Re: Durable Subscriber Annotations for MDB using EJB3
          mskonda Apprentice

           

          @MessageDriven
          (messageListenerInterface=?javax.jms.MessageListener?,activationConfig =
          {
          @ActivationConfigProperty(propertyName="destinationType",propertyValue="javax.jms.Topic"),
          @ActivationConfigProperty(propertyName="destination",propertyValue="mytopic"),
          @ActivationConfigProperty(propertyName="subscriptionDurability",propertyValue="Durable")
          }
          )
          
          Note: If non-durable subscription, propertyValue is NonDurable
          
          


          /MK


          • 2. Re: Durable Subscriber Annotations for MDB using EJB3
            David Small Newbie

            This is great. Is there also a way to set the client ID so that the topic can distinguish subscribers?

            Thanks.

            • 3. Re: Durable Subscriber Annotations for MDB using EJB3
              David Small Newbie

              Bump

              Still looking for the proper annotation to set a client ID for a durable topic MDB subscriber. Any help would be appreicated.

              • 4. Re: Durable Subscriber Annotations for MDB using EJB3
                Bill Burke Master

                 

                @MessageDriven(activationConfig =
                 {
                 @ActivationConfigProperty(propertyName="clientID", propertyValue="xxx"),
                }
                


                You can set any property that is available in org.jboss.ejb3.mdb.MDBConfig




                • 5. Re: Durable Subscriber Annotations for MDB using EJB3
                  Joe W Newbie

                  Did these annotations work for you in creating a MDB with a durable topic subscription?

                  The annotation for subscription durability appears differently here:
                  http://docs.jboss.org/ejb3/app-server/reference/build/reference/en/html_single/index.html#jboss_deployment_descriptor

                  Using either one I am unable to create a durable subscription (MDB works fine aside from that; can see it is NONDURABLE from peaking into the JMX-console for the topic).

                  @MessageDriven(activationConfig =
                  {
                   @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Topic"),
                   @ActivationConfigProperty(propertyName="destination", propertyValue="topic/STMessageTopic"),
                   @ActivationConfigProperty(propertyName="subscriptionDurability",propertyValue="True"),
                   @ActivationConfigProperty(propertyName="user", propertyValue="john"),
                   @ActivationConfigProperty(propertyName="password", propertyValue="needle"),
                  
                  @ActivationConfigProperty(propertyName="subscriptionName", propertyValue="josey")
                  })
                  public class STMessageSubscriberB implements MessageListener {
                  
                  


                  • 6. Re: Durable Subscriber Annotations for MDB using EJB3
                    Joe W Newbie

                    This annotation is incorrect:

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


                    It s/b this:
                    @ActivationConfigProperty(propertyName="durability",propertyValue="Durable")
                    


                    At least with AS 4.04CR2.

                    • 7. Re: Durable Subscriber Annotations for MDB using EJB3
                      Patrick Newbie

                      Hi there,

                      I am toying around with durable subscriptions, too, and ran into the same problems. I observed the following:

                      You can set any property that is available in org.jboss.ejb3.mdb.MDBConfig


                      Funny though that there is no "subscriptionDurability" property in that class. I tried to set the present "durability" property and it look much better.
                      @ActivationConfigProperty(propertyName="Durability",propertyValue="Durable")


                      Next JBoss bothers about a missing subscription name. So here we go:
                      @ActivationConfigProperty(propertyName="subscriptionName",propertyValue = "echoBean")


                      This get's me a bit further, but I still fail due to security constraint:
                      javax.jms.JMSSecurityException: Connection not authorized to do durable subscription on topic: testMDB
                       at org.jboss.mq.security.ServerSecurityInterceptor.subscribe(ServerSecurityInterceptor.java:150)
                       at org.jboss.mq.server.TracingInterceptor.subscribe(TracingInterceptor.java:779)
                       at org.jboss.mq.server.JMSServerInvoker.subscribe(JMSServerInvoker.java:312)
                       at org.jboss.mq.il.jvm.JVMServerIL.subscribe(JVMServerIL.java:329)
                       at org.jboss.mq.Connection.addConsumer(Connection.java:789)
                       at org.jboss.mq.SpyConnectionConsumer.<init>(SpyConnectionConsumer.java:111)
                       at org.jboss.mq.SpyConnection.createDurableConnectionConsumer(SpyConnection.java:196)
                       at org.jboss.ejb3.mdb.MDB.innerCreateTopic(MDB.java:524)
                       at org.jboss.ejb3.mdb.MDB.innerCreate(MDB.java:342)
                       at org.jboss.ejb3.mdb.MDB.innerStart(MDB.java:225)
                       at org.jboss.ejb3.mdb.MDB.start(MDB.java:214)
                      


                      Argh. I specified a user and a password, which are definitely evaluated. But I didn't succeeded yet in hacking my own application server :(.

                       @ActivationConfigProperty(propertyName="Durability",propertyValue="Durable")
                       ,@ActivationConfigProperty(propertyName="subscriptionName",propertyValue="slowEchoBean")
                       ,@ActivationConfigProperty(propertyName="user",propertyValue="guest")
                       ,@ActivationConfigProperty(propertyName="password",propertyValue="guest")
                      


                      So far up to now.

                      Cheers,
                      Patrick

                      p.s.: I am using JBoss AS 4.0.4 GA with EJB3 option on.

                      • 8. Re: Durable Subscriber Annotations for MDB using EJB3
                        Patrick Newbie

                        Well, the security problems is a different thing. (I disabled the SecurityManager and removed user and password and voilá it worked.)

                        But we really have an issue concerning the ActivationConfigProperty name. The EJB3 core specification styates that the name must be "subscriptionDurability" but in the 4.0.4 GA EJB 3 implementation it is simply "Durability".

                        Is there a Bug report for this? What to do to open a new one?

                        Cheers,
                        Patrick

                        • 10. Re: Durable Subscriber Annotations for MDB using EJB3
                          Goran Ehrsson Newbie

                           

                          "jnerd" wrote:

                          I created a Bug report for this issue:
                          http://jira.jboss.com/jira/browse/EJBTHREE-643

                          As of Oct 26 EJBTHREE-643 is still open, but when I upgraded from 4.0.4.GA to 4.0.5.GA today I had to change my @ActivationConfigProperty to
                          (propertyName = "subscriptionDurability", propertyValue = "Durable")
                          My conclusion: 4.0.5.GA is fixed but the jira task is not updated yet.