[jboss-user] [JBoss Messaging] - Durable subscriber

ssuyamboo do-not-reply at jboss.com
Tue Jun 12 10:50:30 EDT 2007


Hi
I am trying to establish publish-durable subscriber using jboss 4.0.3 SP1.
Though I was able to publish messages to topic , my subscriber couldn't read the messages from topic. Are there any preconfigurations to follow to setup durable subscriber?

I added the required topic to jbossmq-destinations-service.xml

As per the jboss documentation , I ran the following program before running publisher and subscriber.

public class DurableTopicSetup
{

   public static void main(String args[]) throws Exception
   {
	   Properties props = new Properties(); 
	   props.setProperty("java.naming.provider.url", "jnp://localhost:1099"); 
	   props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming"); 
	   props.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory"); 
	   InitialContext iniCtx = new InitialContext( props );
	   
      System.out.println("Begin DurableTopicSetup");
      //InitialContext iniCtx = new InitialContext();
      Object tmp = iniCtx.lookup("ConnectionFactory");
      TopicConnectionFactory tcf = (TopicConnectionFactory) tmp;
      TopicConnection conn = tcf.createTopicConnection("john", "needle");
      Topic topic = (Topic) iniCtx.lookup("topic/ecommOrder");
      //Topic topic = (Topic) iniCtx.lookup("topic/testDurableTopic");
      TopicSession session = conn.createTopicSession(false,
         TopicSession.AUTO_ACKNOWLEDGE);
      TopicSubscriber recv = session.createDurableSubscriber(topic, "order topic");
      conn.close();
      System.out.println("End DurableTopicSetup");
      System.exit(0);
   }

}

Can anyone guide me with steps needed to establish durable subscriptions?

Thanks
Sundar




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4053597#4053597

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4053597



More information about the jboss-user mailing list