Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 25139 invoked from network); 19 May 2008 06:23:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 May 2008 06:23:07 -0000 Received: (qmail 7327 invoked by uid 500); 19 May 2008 06:23:07 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 7304 invoked by uid 500); 19 May 2008 06:23:07 -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 7293 invoked by uid 99); 19 May 2008 06:23:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 18 May 2008 23:23:07 -0700 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 May 2008 06:22:13 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1JxylW-0001aq-9B for users@activemq.apache.org; Sun, 18 May 2008 23:22:34 -0700 Message-ID: <17311984.post@talk.nabble.com> Date: Sun, 18 May 2008 23:22:34 -0700 (PDT) From: beaker To: users@activemq.apache.org Subject: Re: Detect consumers? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: beaker222@freenet.de References: <17126905.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org Hello, I tried the Advisory Topics, but somehow I can not manage to get any advisory messages... I have tested this with a small test server I have found here: http://coenraets.org/blog/2007/01/flex-test-drive-server-for-java-developers-tomcat-based/ This is a piece of code where I tried to set up a consumer for the advisory messages: ActiveMQDestination topic = (ActiveMQDestination) context.lookup("ChatTopic"); Destination advisoryDestination = AdvisorySupport.getConsumerAdvisoryTopic(topic); MessageConsumer consumer = session.createConsumer(advisoryDestination); Then I tried to connect some consumers to the topic "ChatTopic", but I never get an advisory message. Can you tell me what is wrong? Is there maybe some kind of example or tutorial on how to do this? Cheers, beaker James.Strachan wrote: > > 2008/5/8 beaker : >> >> Hello, >> >> is it possible for a producer to detect, if there are any consumers on >> the >> topic/queue he is sending? > > Yes - you can use advisories... > http://activemq.apache.org/advisory-message.html > > e.g. try using the ConsumerEventSource helper class... > http://activemq.apache.org/maven/activemq-core/apidocs/org/apache/activemq/advisory/ConsumerEventSource.html > >> I want the producer to only send out messages, if there is someone >> listening >> for them. > > We could maybe enhance the JMS client so that it can avoid sending > messages to topics which have no consumers (i.e. to reduce the cost of > marshalling the message on the wire and sending it to the broker and > the broker consuming it). > > -- > James > ------- > http://macstrac.blogspot.com/ > > Open Source Integration > http://open.iona.com > > -- View this message in context: http://www.nabble.com/Detect-consumers--tp17126905s2354p17311984.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.