Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JBoss User Help »

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

scott.stark@jboss.org

2007-06-12


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
_______________________________________________
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.