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( );