0 Replies Latest reply on Jun 9, 2008 6:26 AM by kks_krishna

    JMS Subsctiber not receiving message

    kks_krishna Newbie

      Look into the following code. I am always getting message as null. why I am not able to receive the message?

       Properties props = new Properties();
       props.setProperty("java.naming.factory.initial",
       "org.jnp.interfaces.NamingContextFactory");
       props.setProperty("java.naming.factory.url.pkgs",
       "org.jboss.naming");
       props.setProperty("java.naming.provider.url", "localhost");
       Context context = new InitialContext(props);
       TopicConnectionFactory tcf = (TopicConnectionFactory) context
       .lookup("ConnectionFactory");
       conn = tcf.createTopicConnection();
       topic = (Topic) context.lookup("topic/BccTopic");
       session = conn.createTopicSession(false,
       TopicSession.AUTO_ACKNOWLEDGE);
       conn.start();
       TopicPublisher send = session.createPublisher(topic);
       TextMessage tm = session.createTextMessage("TestMessage");
       send.publish(tm);
       send.close();
      
       TopicSubscriber topicSubscriber = session.createSubscriber(topic);
       Message msg = topicSubscriber.receive(50);