3 Replies Latest reply on Jun 5, 2003 6:16 PM by Adrian Brock

    persistent subscriber not so persistent?

    l reedy Newbie

      PROBLEM: I've got an example piece of code that connects to a Topic and creates a durable subscriber. When I shutdown the client and then restart the client, it creates a new durable subscriber, instead of connecting to the existing one. I can see a new directory appear in ...../data/jbossmq/file and the subscriber ID changes. This effectively negates the concept of a durable subscriber, since the new ID means that msgs posted before the subscriber's create time will never be seen by it. I seem to get the same results running the DurableSubscriberExample from the JBoss source examples.

      I am under the impression the each time I create a durable subscriber with the name "sub1" I should get reconnected to the prior "sub1" data stream, not create a brand new data stream.

      I'm running jboss 3.2.1 on JDK 1.4.1 on Solaris 9.

      Heres the example client code:

      Properties props = new Properties( );
      props.put( Context.PROVIDER_URL, "jnp://localhost:1099" );
      props.put( Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" );
      props.put( Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory" );
      Context ctx = new InitialContext( props );

      TopicConnectionFactory tFactory = (TopicConnectionFactory) ctx.lookup( "RMIConnectionFactory" );
      TopicConnection connection = tFactory.createTopicConnection( "java", "java" );

      Topic myDest = (Topic) ctx.lookup( topicName );

      TopicSession session = connection.createTopicSession( false, Session.CLIENT_ACKNOWLEDGE );
      TopicSubscriber sub = session.createDurableSubscriber( myDest, subscriberName );

      sub.setMessageListener( new MessageProcessor( false ) );

      System.out.println( "debug: " + sub.toString() );
      connection.start( );

        • 1. Re: persistent subscriber not so persistent?
          l reedy Newbie

          P.S.: I've also noticed that jbossmq will allow more than one subscriber to be connected using the same name. I.E. I can have several copies of my client connected all using the name "sub1". I thought that the JMS spec says that only one client at a time can use a particular subscriber name?

          • 2. Re: persistent subscriber not so persistent?
            l reedy Newbie

            I figured it out. My client was acquiring a new ID each time because of a malformed jbossmq-state.xml file. D'OH!

            I config'ed jbossmq to use the UserRolesLoginModule, which results in user/password entries in both the jbossmq-state.xml and the user/roles.properties files. It seems that you can ignore the password and role entries in jbossmq-state.xml if you have them defined properly in the .properties files.

            My issue was that I had buggered up the jbossmq-state file inadvertantly.

            • 3. Re: persistent subscriber not so persistent?
              Adrian Brock Master

              Can you post the example code that
              broke your jbossmq-state.xml?

              What is just the old chestnut that you were
              using an anonymous connection to make a
              durable subscription?