0 Replies Latest reply on Aug 29, 2002 11:29 AM by chumps

    how to view messages posted to a JMS topic

    chumps

      Hello,

      Is there a way to see the messages that have been posted to a topic using some admin tool? I have the follwing code that sends a message to a topic and the MDB registered to that topic isn't invoked. I want to make sure that the message re truelly sent to the topic before concluding that there is a problem with the bean deployment. Any help would be greatly appreciated. Here is the code fragment

      Context jndiContext = new InitialContext();
      TopicConnectionFactory topicFactory = (TopicConnectionFactory)
      jndiContext.lookup("ConnectionFactory");
      Topic dmsTopic = (Topic)
      jndiContext.lookup("topic/dmsTopic");
      TopicConnection connection = topicFactory.createTopicConnection();
      TopicSession session = connection.createTopicSession(true,0);
      TopicPublisher publisher = session.createPublisher(dmsTopic);
      TextMessage msg = session.createTextMessage("/collections/test");
      QueueConnectionFactory queueFactory = (QueueConnectionFactory)
      jndiContext.lookup("ConnectionFactory");
      QueueConnection queueConnection = queueFactory.createQueueConnection();
      QueueSession queueSession = queueConnection.createQueueSession(true,0);
      Queue replyQueue = queueSession.createTemporaryQueue();
      msg.setJMSReplyTo(replyQueue);
      QueueReceiver receiver = queueSession.createReceiver(replyQueue);
      System.out.println("sending message");
      publisher.publish(msg);
      connection.start();
      queueConnection.start();
      System.out.println("receiving message");
      TextMessage response = (TextMessage) receiver.receive(10000);
      System.out.println("got message");

      further more the topic is declared like this in the destinations file:

      <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager
      <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager










      Thanks.