Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 94138 invoked from network); 9 Feb 2007 20:50:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Feb 2007 20:50:36 -0000 Received: (qmail 92409 invoked by uid 500); 9 Feb 2007 20:50:42 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 92392 invoked by uid 500); 9 Feb 2007 20:50:42 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 92383 invoked by uid 99); 9 Feb 2007 20:50:42 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Feb 2007 12:50:42 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of james.strachan@gmail.com designates 66.249.92.169 as permitted sender) Received: from [66.249.92.169] (HELO ug-out-1314.google.com) (66.249.92.169) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Feb 2007 12:50:32 -0800 Received: by ug-out-1314.google.com with SMTP id m3so917228ugc for ; Fri, 09 Feb 2007 12:50:09 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=naWWb3f0J42oQ3xEaztCvJua76OiOe12LH5ZyplLj88ZYkkDm6zbBptuQVWZ9G4cE5b+539gk8GEO3s8dLF8ofynczo+px0wnDuEJS5PMoRHBbS+xU9gbyZ0a2Cmuj763NZE1i6SVJbLDEXmGNptrmVVBLTqxvqCkcuy8hPb02E= Received: by 10.78.138.6 with SMTP id l6mr5155777hud.1171054209062; Fri, 09 Feb 2007 12:50:09 -0800 (PST) Received: by 10.78.155.6 with HTTP; Fri, 9 Feb 2007 12:50:08 -0800 (PST) Message-ID: Date: Fri, 9 Feb 2007 20:50:09 +0000 From: "James Strachan" To: users@activemq.apache.org Subject: Re: durable subscriptions not working In-Reply-To: <5BD9FA70F5EDAC43AB816A5FDE30F6AC039943A3@xmb-sjc-21a.amer.cisco.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <5BD9FA70F5EDAC43AB816A5FDE30F6AC039943A3@xmb-sjc-21a.amer.cisco.com> X-Virus-Checked: Checked by ClamAV on apache.org Do you create the subscriber first before running the publisher? On 2/9/07, Suchitha Koneru (sukoneru) wrote: > Hello active mq users , > I have Java 1.5.09 , Tomcat 5.5 . > I am using the following active mq jars activemq-core-4.0.1.jar , > backport-util-concurrent-2.1.jar , geronimo-j2ee- > management_1.0_spec-1.0.jar, geronimo-jms_1.1_spec-1.0.jar , > incubator-activemq-4.0.2.jar > > I have two classes Herbie Publisher , Herbie Subscriber . The > ConnectionFactory and the Topic are mentioned as JNDI resources in > Tomcat/Conf/Context.xml > > auth="Container" > type="org.apache.activemq.ActiveMQConnectionFactory" > description="JMS Connection Factory" > factory="org.apache.activemq.jndi.JNDIReferenceFactory" > brokerURL="tcp://localhost:61616" > brokerName="LocalActiveMQBroker" > /> > > auth="Container" > type="org.apache.activemq.command.ActiveMQTopic" > description="the topic against which the client back end > will publish and server back end would subscribe" > > factory="org.apache.activemq.jndi.JNDIReferenceFactory" > physicalName="FOO3.BAR"/> > > The code for Herbie Publisher is as follows > //code for intialization > Ictx = new InitialContext(); > > envContext =(Context ) Ictx.lookup("java:comp/env"); > > //code for getting connection , creating session and publishing > try{ > > javax.jms.TopicConnectionFactory factory = > (javax.jms.TopicConnectionFactory)envContext.lookup("jms/ConnectionFacto > ry"); > > // create a new TopicConnection for pub/sub messaging > > HerbieTopicConnection = factory.createTopicConnection(); > > topic = (Topic)envContext.lookup("jms/PNMTopic") ; > > if(HerbieTopicConnection != null){ > > HerbieSession = > (ActiveMQSession)HerbieTopicConnection.createSession(false, > Session.AUTO_ACKNOWLEDGE); > > HerbieTopicConnection.start(); > > TopicPublisher pub = Sess.createPublisher(topic); > > pub.setTimeToLive(10000); > > pub.setDeliveryMode(DeliveryMode.PERSISTENT); > > String msg = "This is a test message"; > > pub.send( Sess.createTextMessage(msg)); > > pub.close(); > > Sess.close(); > > HerbieTopicConnection.close(); > > } > > catch(Exception e){ > > e.printStackTrace(); > > } > > The Herbie Subscriber code is as follows > // Intialiization same as Herbie Publisher , same as above > //establish connection, create durable subscriber and receive messages > > javax.jms.TopicConnectionFactory factory = > (javax.jms.TopicConnectionFactory)envContext.lookup("jms/ConnectionFacto > ry"); > > HerbieTopicConnection = factory.createTopicConnection(); > > topic = (Topic)envContext.lookup("jms/PNMTopic") ; > > if(HerbieTopicConnection != null){ > > HerbieSession = > (ActiveMQSession)HerbieTopicConnection.createSession(false, > Session.AUTO_ACKNOWLEDGE); > > topic = (Topic)envContext.lookup("jms/PNMTopic") ; > > //creating durable subscriber using topic and subscription name > > TopicSubscriber Subs = > Sess.createDurableSubscriber(topic,"durablesubscription"); > > HerbieTopicConnection.setCleintID("CLIENTID"); > > HerbieTopicConnection.start(); > > public void onMessage(Message arg0) { > > System.out.println("Received message: " + arg0.toString()); > > } > > } > > I do not see the messages getting exchanged. I am not sure , as to what > went wrong. Please let me know, If Iam missing anything in the > configuration. As of now,, I am using tuple(CLientID, Topic , > subscription name) to uniquely identify the durable subscription. > > thank you, > Suchitha. > > > > > > > > -- James ------- http://radio.weblogs.com/0112098/