From activemq-users-return-4457-apmail-geronimo-activemq-users-archive=geronimo.apache.org@geronimo.apache.org Tue Sep 12 01:03:52 2006 Return-Path: Delivered-To: apmail-geronimo-activemq-users-archive@www.apache.org Received: (qmail 25120 invoked from network); 12 Sep 2006 01:03:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 12 Sep 2006 01:03:52 -0000 Received: (qmail 6616 invoked by uid 500); 12 Sep 2006 01:03:51 -0000 Delivered-To: apmail-geronimo-activemq-users-archive@geronimo.apache.org Received: (qmail 6594 invoked by uid 500); 12 Sep 2006 01:03:51 -0000 Mailing-List: contact activemq-users-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-users@geronimo.apache.org Delivered-To: mailing list activemq-users@geronimo.apache.org Received: (qmail 6585 invoked by uid 99); 12 Sep 2006 01:03:51 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Sep 2006 18:03:51 -0700 Authentication-Results: idunn.apache.osuosl.org smtp.mail=aco@exist.com; spf=permerror X-ASF-Spam-Status: No, hits=2.0 required=5.0 tests=RCVD_IN_BL_SPAMCOP_NET Received-SPF: error (idunn.apache.osuosl.org: domain exist.com from 64.14.253.182 cause and error) Received: from ([64.14.253.182:48338] helo=mail.exist.com) by idunn.apache.osuosl.org (ecelerity 2.1 r(10620)) with ESMTP id E9/51-28385-87706054 for ; Mon, 11 Sep 2006 18:03:53 -0700 Received: from [192.168.241.120] ([58.71.14.245]) (authenticated bits=0) by mail.exist.com (8.12.11/8.12.11) with ESMTP id k8C0wRcT030527 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 11 Sep 2006 17:58:31 -0700 Message-ID: <45060763.9040701@exist.com> Date: Tue, 12 Sep 2006 09:03:31 +0800 From: Adrian Co User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 To: activemq-users@geronimo.apache.org Subject: Re: receive() method not working on TopicSubscriber References: <7e4090a10609101648m5a8e02a8x29625434a2d1a3ca@mail.gmail.com> <04e501c6d540$9e76b200$64f1a8c0@JLIM> <7e4090a10609101835m1a27a9e9t5a694ce7fe60e18a@mail.gmail.com> <052a01c6d54f$48ec3490$64f1a8c0@JLIM> <7e4090a10609110206o1aa788c6o3a38e879deb3484c@mail.gmail.com> In-Reply-To: <7e4090a10609110206o1aa788c6o3a38e879deb3484c@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Could you post your broker config? You could also check your broker via JMX to see if messages are being received in the topic. rabidgremlin wrote: > Yep the producer is working fine. If I run the old version of the code at > the same time it receives messages. > > Don't have a sample bit of code for the producer that I can post :( > > The producer does something a little odd in that it connects and > disconnects > from the broker every few messages. > > Could this be the problem ? > > Jonathan > > > On 9/11/06, Jonas Lim wrote: >> >> Can you check that your producer is actually sending messages to the >> topic >> after running your consumer? >> >> It looks like your code should be able to receive messages from the >> topic. >> Could you also post your producer code >> >> Regards, >> Jonas >> >> >> ----- Original Message ----- >> From: "rabidgremlin" >> To: >> Sent: Monday, September 11, 2006 9:35 AM >> Subject: Re: receive() method not working on TopicSubscriber >> >> >> > yep.... here is the snippet of code of some test code: >> > >> > 1) topicConnection = topicConnectionFactory.createTopicConnection >> (); >> > 2) topicConnection.setExceptionListener(new ExceptionHandler()); >> > 3) topicSession = topicConnection.createTopicSession(false, >> > Session.AUTO_ACKNOWLEDGE); >> > 4) topic = topicSession.createTopic(topicName); >> > >> > 5) topicSubscriber = topicSession.createSubscriber(topic); >> > 6) //topicListener = new TextListener(); >> > 7) //topicSubscriber.setMessageListener(topicListener); >> > >> > 8) System.out.println("Starting subscriber press CTRL+C to >> kill"); >> > 9) topicConnection.start(); >> > >> > 10) // now lets wait forever to avoid the JVM terminating >> immediately >> > 11) //Object lock = new Object(); >> > 12) //synchronized (lock) >> > 13) //{ >> > 14) // lock.wait(); >> > 15) //} >> > >> > 16) while (true) >> > 17) { >> > 18) System.out.println("@@@@ " + topicSubscriber.receive >> > ().toString()); >> > 19) //Thread.sleep(1000); >> > 20) } >> > >> > If I comment out lines 16-20, and uncomment lines 6-7 and 10-15 then >> > everthing works..... >> > >> > On 9/11/06, Jonas Lim wrote: >> >> >> >> Hi, >> >> >> >> Can you check if you're calling the connection's start method >> >> (connection.start()) before calling the receive() method? >> >> >> >> Regards, >> >> Jonas >> >> >> >> >> >> ----- Original Message ----- >> >> From: "rabidgremlin" >> >> To: >> >> Sent: Monday, September 11, 2006 7:48 AM >> >> Subject: receive() method not working on TopicSubscriber >> >> >> >> >> >> > Hi All, >> >> > >> >> > I have a piece of code which sets up a TopicSubscriber with a >> >> > MessageListener. This works fine. >> >> > >> >> > I'm now trying to poll the TopicSubscriber instead (it suits my >> code >> >> > better). >> >> > >> >> > So now my code does not register a listener and simply calls >> receive() >> >> on >> >> > the TopicSubscriber. >> >> > >> >> > However this does not work :( The receive() method never returns. >> >> > >> >> > What do I need to do differently to get the receive() method to >> >> > function >> >> > correctly ? >> >> > >> >> > Thanks >> >> > >> >> > Jonathan >> >> > >> >> >> >> >> > >> >> >