2 Replies Latest reply on Aug 24, 2001 12:02 PM by frank starsinic

    Creating a durable subscriber

    Mark Crowley Newbie

      Having read the documentation I was hoping someone could clarify how to create a durable subscriber.

      I have a pub/sub messaging sytem running.

      I have changed my publisher to publish messages as persistent.

      I have added a user as per the docuementation to jbossmq.xml, and specified the id in the createDurableSubscriber(topic, id) call.

      The following execption is thrown

      java.rmi.RemoteException: ; nested exception is:
      javax.jms.JMSException: That destination queue does not exist

      If I just call createSubscriber(topic) everything is fine.

      I have hunted around the forums (and the old mailing lists), a couple of users seem to have encounterd this before, but no replies were given.

      I'm 100% sure its just a setup problem.

      Thanks in advance.

        • 1. Re: Creating a durable subscriber
          Mark Crowley Newbie

          OK have just answered my own question.

          Here is the solution. When creating a durable subscriber your initial connection must be created using topicConnectionFactory.createTopicConnection(user, pwd).

          This logs you on to the messaging service, you can then reference the id. So for the example user given:


          john
          needle
          DurableSubscriberExample


          you would code the following:

          topicConnection = topicConnectionFactory.createTopicConnection("john", "needle");
          topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
          topicSession.createDurableSubscriber(topic, "DurableSubscriberExample");

          incidently you can have the following user, which doesn't require a username or password:




          DurableSubscriberExample


          you still have to call topicConnectionFactory.createTopicConnection(user, pwd) but pass in empty strings as the parameters.

          Hope this makes sense.

          Mark Crowley.

          • 2. Re: Creating a durable subscriber
            frank starsinic Newbie

            I had the exact same problem, however I was not able to resolve it using this method, though it is probably a good first step. I still get the following error:

            [Default] Client request caused an exception:
            [Default] javax.jms.JMSException: That destination queue does not exist on the server ...
            and ...
            Connection problem: javax.jms.JMSException: Cannot subscribe to this Destination
            java.io.EOFException
            at java.io.ObjectInputStream.readByte(ObjectInputStream.java:1908)
            at org.jbossmq.distributed.server.DistributedJMSServerUILClient.waitAnswer(DistributedJMSServerUILClient.java:107)
            at org.jbossmq.distributed.server.DistributedJMSServerUILClient.unsubscribe(DistributedJMSServerUILClient.java:287)
            at org.jbossmq.SpyConnection.removeConsumer(SpyConnection.java:557)
            at org.jbossmq.SpySession.removeConsumer(SpySession.java:423)
            at org.jbossmq.SpyMessageConsumer.close(SpyMessageConsumer.java:208)
            at org.jbossmq.SpySession.close(SpySession.java:275)
            at org.jbossmq.SpyConnection.close(SpyConnection.java:219)
            at proto.DurableSubscriberExample$DurableSubscriber.(DurableSubscriberExample.java:103)
            at proto.DurableSubscriberExample.run_program(DurableSubscriberExample.java:256)
            at proto.DurableSubscriberExample.main(DurableSubscriberExample.java:285)

            on the client

            another difference could be the deployment descriptor.
            Here's what I'm using ...

            <?xml version="1.0"?>
            <!DOCTYPE ejb-jar>
            <ejb-jar>
            <enterprise-beans>
            <message-driven>
            <ejb-name>HelloTopicDurableMDB</ejb-name>
            <ejb-class>proto.HelloMDB</ejb-class>
            <message-selector></message-selector>
            <transaction-type>Container</transaction-type>
            <message-driven-destination>
            <destination-type>javax.jms.Topic</destination-type>
            <subscription-durability>Durable</subscription-durability>
            </message-driven-destination>
            </message-driven>
            </enterprise-beans>
            <assembly-descriptor>
            <container-transaction>

            <ejb-name>HelloTopicDurableMDB</ejb-name>
            <method-name>*</method-name>

            <trans-attribute>Required</trans-attribute>
            </container-transaction>
            </assembly-descriptor>
            </ejb-jar>


            and


            <?xml version="1.0" encoding="Cp1252"?>

            <enterprise-beans>
            <message-driven>
            <ejb-name>HelloTopicDurableMDB</ejb-name>
            <configuration-name>Standard Message Driven Bean</configuration-name>
            <destination-jndi-name>topic/testTopic</destination-jndi-name>
            <mdb-user>john</mdb-user>
            <mdb-passwd>needle</mdb-passwd>
            <mdb-client-id>DurableSubscriberExample</mdb-client-id>
            </message-driven>
            </enterprise-beans>



            If anyone sees anything let me know.
            thanks,
            frank