4 Replies Latest reply on Feb 3, 2019 7:38 PM by jbertram

    Wildfly 10 JMS 2.0 MDB - Shared Durable Subscription

    mattrih

      Hello,

       

      I am attempting to create a Shared Durable Subscription in my JEE 7 app running inside Wildfly 10, however I am getting an error when running two instances of my app, in their own instances of Wildfly, which suggests that my subscription is not shared.

       

      I have seen code examples of how to do this programmatically but I am attempting to do this via MDB and annotations.

       

      The ActivationConfiguration (http://docs.oracle.com/javaee/7/api/javax/ejb/ActivationConfigProperty.html) properties don’t appear to provide a standard way to configure the ‘shared’ aspect of the subscription and whilst I can configure a durable subscription I am not able to make it shared and am therefore receiving the following error when attempting to run my applications in multiple instances of Wildfly.

       

       

       

      2016-09-09 15:51:56,930 ERROR [org.apache.activemq.artemis.ra] (default-threads - 9) AMQ154003: Unable to reconnect org.apache.activemq.artemis.ra.inflow.ActiveMQActivationSpec(ra=org.apache.activemq.artemis.ra.ActiveMQResourceAdapter@d9a8b336 destination=myTopic destinationType=javax.jms.Topic ack=Auto-acknowledge durable=true clientID=null subscription=myTopicSubscription user=null maxSession=15): javax.jms.IllegalStateException: Cannot create a subscriber on the durable subscription since it already has subscriber(s)

        at org.apache.activemq.artemis.ra.inflow.ActiveMQMessageHandler.setup(ActiveMQMessageHandler.java:122)

        at org.apache.activemq.artemis.ra.inflow.ActiveMQActivation.setup(ActiveMQActivation.java:318)

        at org.apache.activemq.artemis.ra.inflow.ActiveMQActivation.reconnect(ActiveMQActivation.java:678)

        at org.apache.activemq.artemis.ra.inflow.ActiveMQActivation$SetupActivation.run(ActiveMQActivation.java:722)

        at org.jboss.jca.core.workmanager.WorkWrapper.run(WorkWrapper.java:223)

        at org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33)

        at org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:808)

        at org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:45)

        at org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:828)

        at java.lang.Thread.run(Thread.java:745)

        at org.jboss.threads.JBossThread.run(JBossThread.java:320)

       

      I have code that looks like the following:

       

      @MessageDriven(
           activationConfig = {
               @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
               @ActivationConfigProperty(propertyName = "destinationLookup", propertyValue = “myTopic”),
               @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable"),
               @ActivationConfigProperty(propertyName = "clientId", propertyValue = “appListener”),
               @ActivationConfigProperty(propertyName = "subscriptionName", propertyValue = “myTopicSubscription”)
           }
       )
       public class MyJmsListener implements MessageListener {
      }
      

       

      Other containers appear to provide an additional property, such as:

       

      @ActivationConfigProperty(propertyName = "sharedSubscription", propertyValue = "TRUE"),
      

       

      Any help is appreciated.

       

      Thanks