Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 59704 invoked from network); 12 Jun 2009 23:44:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Jun 2009 23:44:25 -0000 Received: (qmail 37808 invoked by uid 500); 12 Jun 2009 23:44:36 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 37740 invoked by uid 500); 12 Jun 2009 23:44:36 -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 37728 invoked by uid 99); 12 Jun 2009 23:44:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Jun 2009 23:44:36 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of tabish121@gmail.com designates 74.125.92.150 as permitted sender) Received: from [74.125.92.150] (HELO qw-out-1920.google.com) (74.125.92.150) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Jun 2009 23:44:25 +0000 Received: by qw-out-1920.google.com with SMTP id 5so1492373qwc.26 for ; Fri, 12 Jun 2009 16:44:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:in-reply-to :references:content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=hfG/pW5AVLF3/NuWQsg8s69TdEh6OJn5dvgswtqV4n8=; b=mj38T+D8mgMv5n2Icj0nqyRMVRONzTqNgW5yJqP86ttDAkCgvr/5zHtm2k14l2dbbo AyV3g11s6XPWViZxdyQkAWyS7WmqoeeuoNYWWajo++/69mXVObrdifH9fAVcVBGkmUoz AniAV+UnPZOpxKNJM9cNtEVef1IMB6hslTgZQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:in-reply-to:references:content-type:date:message-id :mime-version:x-mailer:content-transfer-encoding; b=Evmquso9YHO9KiSu64PLtnuUUl0QDUp5FsCG0UtlbFRuDdwMiLbAQnC6xL8HDsmO9N 7bDSsOgR92EEAbz3rFBLHSheU83t2a8/vgBKKyU4Ch5WDSPDZ7vrYJLBnZaSOM0LN3q2 ZDzp9b62K/k+UrPuLAZitYASDfnREaU8ayVYQ= Received: by 10.224.89.8 with SMTP id c8mr4947705qam.371.1244850245014; Fri, 12 Jun 2009 16:44:05 -0700 (PDT) Received: from ?192.168.2.199? ([68.49.143.174]) by mx.google.com with ESMTPS id 7sm162465qwb.46.2009.06.12.16.44.03 (version=SSLv3 cipher=RC4-MD5); Fri, 12 Jun 2009 16:44:04 -0700 (PDT) Subject: Re: ActiveMQ-CPP and Advisory messages From: Timothy Bish To: users@activemq.apache.org In-Reply-To: <23983516.post@talk.nabble.com> References: <23983516.post@talk.nabble.com> Content-Type: text/plain Date: Fri, 12 Jun 2009 19:44:02 -0400 Message-Id: <1244850242.23603.9.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 (2.24.5-1.fc10) Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On Thu, 2009-06-11 at 08:26 -0700, Nascent wrote: > Scenario: > I have a consumer written in C++ that uses ActiveMQ-CPP to communicate with > ActiveMQ. It implements a callback interface where a client can request > on-change updates for data points. The consumer then does a response message > to the original request from the client any time the data point updates. The > response messages go to a temporary queue (reply queue basically) that is > associated with the client. > > Problem: > I am trying to figure out a way for the consumer to know that the client has > gone away so it can stop sending updates and free up resources associated > with that client. I cannot always trust that the client will send some kind > of unsubscribe message. I am looking for a way that the consumer can know > authoritatively that the client has either disconnected from ActiveMQ or > that the temporary/reply queue for that client is no longer valid. It seems > like ActiveMQ's Advisory messages are the solution however I don't see how > they can be used through ActiveMQ-CPP since the messages use Java objects as > the body. > > Questions: > Is there anyway to make use of the advisory messages through ActiveMQ-CPP? > Since this seemed like a question that might confront many ActiveMQ-CPP users I've created a Tutorial on it on the CMS Wiki. Here's the link: http://activemq.apache.org/cms/handling-advisory-messages.html The tutorial is a work in progress, so comments are welcome, if you see something that needs more explanation let me know. I also created an example Producer and Consumer that show the basics of using the advisory messages. You will need to download the latest SVN source to see the code, its in the src/exmaples/advisories folder. Regards Tim. > Is there perhaps a better way to handle the scenario listed above that has > less overhead? I have considered using a topic that all data point updates > would go to and then clients could consume with a selector to get only the > updates they care about. However, in my case, there are potentially hundreds > of data points updating every second and clients are usually only interested > in a handful of them. So it seems inefficient to me to have all these data > point updates going to a topic where less than 5% of them may actually be > consumed. > > Thanks in advance! -- Tim Bish http://fusesource.com http://timbish.blogspot.com/