4 Replies Latest reply on Jul 17, 2003 3:32 AM by Adrian Hallam

    MDB (Durable) not receiving message

    Adrian Hallam Newbie

      I have created an MDB that is a Durable Subscriber and is not receiving any messages posted to it's topic (topic/testDurableTopic for now).

      I am running JBoss 3.2.1 with Java 1.4.2-b28. I have also tried different JBoss's and Java's so I presume the problem is something to do with what I am doing.

      ejb-jar.xml snippet:
      =============
      <message-driven>
      <ejb-name>EventTestAsync1EJB</ejb-name>
      <ejb-class>myPackage.TestHandlerAsync</ejb-class>
      <transaction-type>Container</transaction-type>
      <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
      <message-driven-destination>
      <destination-type>javax.jms.Topic</destination-type>
      <subscription-durability>Durable</subscription-durability>
      </message-driven-destination>
      </message-driven>

      * trans-attribute is set to NotSupported


      jboss.xml snippet:
      ============
      <message-driven>
      <ejb-name>EventTestAsync1EJB</ejb-name>
      <configuration-name>Standard Message Driven Bean</configuration-name>
      <destination-jndi-name>topic/testDurableTopic</destination-jndi-name>
      <mdb-user>eventlistener</mdb-user>
      <mdb-passwd></mdb-passwd>
      <mdb-subscription-id>EventListener</mdb-subscription-id>
      </message-driven>

      post to topic code snippet:
      ===================

      InitialContext ctx = new InitialContext();
      // XATopicConnectionFactory topicConnectionFactory = (XATopicConnectionFactory)ctx.lookup("OIL2XAConnectionFactory");
      XATopicConnectionFactory topicConnectionFactory = (XATopicConnectionFactory)ctx.lookup("XAConnectionFactory");
      TopicConnection topicConnection = topicConnectionFactory.createTopicConnection("eventmanager", "");

      Topic topic = (Topic)ctx.lookup("topic/testDurableTopic");
      TopicSession topicSession = topicConnection.createTopicSession(true, TopicSession.AUTO_ACKNOWLEDGE);
      topicConnection.start();

      // Create message
      MapMessage message = topicSession.createMapMessage();

      // Load message with info from LavaEvent
      message.setObjectProperty("SampleKey", "SampleValue");

      TopicPublisher topicPublisher = topicSession.createPublisher(topic);
      topicPublisher.publish(topic, message);

      topicConnection.close();

      // this runs and doesn't throw an exception...


      ====

      * I have added the 2 users to jbossmq-state.xml. These users were added to all roles.

      The jmx-console page for the topic shows that the DurableSubcribers increases to 1 when I deploy. The listener just does a System.out.println (and some logging) at the moment. As this never reaches the console (or logging to the log files), I presume my listener is never being called.

      Most of the samples I have found are for Queue's. Is there any samples for DurableSubscription? Alternatively if you can see a silly mistake in my stuff could you please let me know?

      Any help is appreciated. Thanks, Adrian