0 Replies Latest reply: Feb 20, 2013 6:05 AM by 986609 RSS

    Browsing a Topic to get all messages with Unregistered Client ID (Sun MQ)

    986609
      There is a challenging Situation before me

      Server: SUN MQ

      Topic: ABC have 120 Messages

      I got credentials of brokers and i am making client to it

      I have made a Subscriber with Demo Client ID and Demo Subscription Name.

      I am able to subscribe to Topic

      I am unable to get 120 Messages already present in Topic

      I am able to get new messages which i send to that Topic

      As queuebrowser is available there is no Topic Browser in IMQ Jars.

      I have no access to server so i could not set Client ID or Subscription name so demo is going on

      I need 120 Messages which are already present....How can I?

      Code:

      connection.setClientID("DEMO");

      session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE);

      com.sun.messaging.Topic objTopic = new com.sun.messaging.Topic(destinationName);

      MessageConsumer obj1 =  session.createDurableSubscriber(objTopic,"Endra");

      JMSListener obj2 = new JMSListener();

      obj1.setMessageListener(obj2);

      connection.setExceptionListener(obj2);

      connection.start

      JMS Listener Class

      public class JMSListener implements MessageListener,ExceptionListener
      +{+
      +@Override+
      public void onMessage(Message msg)
      +{+
      try
      +{+
      System.out.println(((TextMessage)msg).getText());
      +}+
      catch (JMSException ex)
      +{+
      Logger.getLogger(JMSConnection.class.getName()).log(Level.SEVERE, null, ex);
      +}+
      System.out.println("Here it is");
      +}+



      +@Override+
      +public void onException(JMSException jmse) {+
      System.out.println(""jmse);+
      +}+
      +}+


      Started here after directed by Kelly -> https://forums.oracle.com/forums/profile.jspa?userID=795993