0 Replies Latest reply on Oct 9, 2002 10:05 PM by maor71

    applet messagelistener not executing

    maor71

      hello guys,
      to begin with I am pretty much a novice on setting up Jboss topics/Queues but I manage to set up one, and with a client app I was able to send message and subscribe to messages using applications withing JBoss 3.03.
      Now I am using an applet, I manage to subscribe to the topic by means of the UILConnectionFactory, I generate the message my internal app that is subscribe gets is, but my applet does not.

      This is snippet of code relevant of what I am doing ..

      I know the message gets publish, since my client within the Jboss app is receiving it and STDOUT'it , but my applet does not move.
      The JmsClient_1 is running on a seperate thread once the applet loads , could that be the problem?

      thanks


      public class JmsClient_1 implements javax.jms.MessageListener {
      .
      .
      .


      Properties jndiProps = new Properties() ;
      jndiProps.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory" ) ;
      jndiProps.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces" ) ;
      jndiProps.setProperty("java.naming.provider.url", "localhost:1099" ) ;

      Context jndiContext = new InitialContext(jndiProps);

      System.out.println(" the jndiContext is .."+ jndiContext.toString());

      TopicConnectionFactory factory =
      (TopicConnectionFactory)jndiContext.lookup("UILConnectionFactory");


      System.out.println(" the factory is .."+ factory);

      Topic topic = (Topic) jndiContext.lookup("topic/titan-TicketTopic");

      System.out.println(" the topic is .."+ topic);

      TopicConnection connect = factory.createTopicConnection();

      System.out.println(" the CONNECT is .."+ connect);

      TopicSession session =
      connect.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);

      TopicSubscriber subscriber = session.createSubscriber(topic);

      System.out.println(" the Subscriber is .."+ subscriber);

      subscriber.setMessageListener(this);

      System.out.println("Listening for messages on topic/titan-TicketTopic...");
      connect.start();

      .
      .
      }

      public void onMessage(Message message) {
      try {
      TextMessage textMsg = (TextMessage)message;
      String text = textMsg.getText();
      String msgCorID = message.getJMSType() ;

      System.out.println("\n RESERVATION RECEIVED:\n"+text +"\n CorrID : " + msgCorID + "\n");

      // thechatclient.SendMessage("Person1", "ChatMessage", "ellotext");

      } catch(JMSException jmsE) {
      jmsE.printStackTrace();
      }
      }