Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-1547

Session.unsubscribe does not clear JMS messages from the database

    XMLWordPrintable

Details

    • Bug
    • Resolution: Can't Do
    • Major
    • None
    • JBossAS-4.0.1 Final
    • JMS (JBossMQ)
    • None

    Description

      I am testing durable topic subscription and have the following issue:
      session.unsubscribe("") clears the subscription from the database, but does not clear the JMS messages stored for this subscription from the JMS_MESSAGES table. I am using MS SQL Server 2000 to store the messages. Here is my test code:

      public Result testTopic(TopicJMSPerformanceTestSetup setup){
      try{
      boolean guaranteed = setup.isGuaranteed();
      long t = System.currentTimeMillis();
      log("Testing " + (guaranteed ? " guaranteed" : " non-guaranteed") + " topic connection delivery...");
      TopicConnectionFactory factory = connector.getTopicConnectionFactory();
      TopicConnection conn;
      try

      { conn = factory.createTopicConnection( connector.getJMSProperty(ContextJMSConnector.JMS_PROPERTY_CONNECTION_USERNAME), connector.getJMSProperty(ContextJMSConnector.JMS_PROPERTY_CONNECTION_PASSWORD)); log("Connected as " + connector.getJMSProperty(ContextJMSConnector.JMS_PROPERTY_CONNECTION_USERNAME) + " Topic connection: " + conn); }

      catch(JMSConnectorException ex)

      { conn = factory.createTopicConnection(); log("Connected using the default user credentials. Topic connection: " + conn); }

      conn.start();
      try{
      log("Topic connection: " + conn);
      TopicSession session = conn.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      log("Topic session: " + session);
      int mode = (guaranteed ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT);
      TopicPublisher publisher = session.createPublisher(connector.getTopic(TOPIC_INTERNAL_NAME));
      publisher.setDeliveryMode(mode);
      log("Message publisher: " + publisher);
      TopicSubscriber subscriber = null;
      if(guaranteed)
      subscriber = session.createDurableSubscriber(connector.getTopic(TOPIC_INTERNAL_NAME), "testDurableSubscriber");
      else
      subscriber = session.createSubscriber(connector.getTopic(TOPIC_INTERNAL_NAME));
      long objectCreationTime = System.currentTimeMillis() - t;
      log("Message subscriber: " + subscriber);
      //flush topic messages
      log("Clearing " + empty(subscriber) + " messages from the test topic." );
      long messageSendingTime = 0;
      try

      { log("Publishing/receiving " + setup.getIterations() + (guaranteed? " persistent" : " non-persistent") + " messages, Size = " + setup.getMessageSize() + " bytes..."); messageSendingTime = work(publisher, subscriber, session, setup); }

      finally{
      try

      { subscriber.close(); publisher.close(); }

      finally

      { if(guaranteed) session.unsubscribe("testDurableSubscriber"); }

      session.close();
      }
      log("Message publishing finished. Time: " + messageSendingTime + " msec\n");
      return new PerformanceResult(setup, objectCreationTime, messageSendingTime);
      }finally

      { conn.close(); }

      }catch(Exception e)

      { String message = "ERROR!\nError executing test. Message: " + e + "\nTest setup: " + setup + "\nTime: " + SimpleDateFormat.getTimeInstance().format(new Date()); log(message + "\n", Level.ERROR); e.printStackTrace(); return new ResultImpl(message); }

      }

      Attachments

        1. Client.java
          1 kB
        2. server.log
          10 kB

        Activity

          People

            adrian.brock Adrian Brock (Inactive)
            plamentodorov_jira Plamen Todorov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: