Return-Path: Delivered-To: apmail-geronimo-activemq-users-archive@www.apache.org Received: (qmail 60643 invoked from network); 21 Jun 2006 06:14:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 21 Jun 2006 06:14:27 -0000 Received: (qmail 51626 invoked by uid 500); 21 Jun 2006 06:14:24 -0000 Delivered-To: apmail-geronimo-activemq-users-archive@geronimo.apache.org Received: (qmail 51587 invoked by uid 500); 21 Jun 2006 06:14:24 -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 51563 invoked by uid 99); 21 Jun 2006 06:14:24 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Jun 2006 23:14:23 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of james.strachan@gmail.com designates 66.249.92.175 as permitted sender) Received: from [66.249.92.175] (HELO ug-out-1314.google.com) (66.249.92.175) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Jun 2006 23:14:22 -0700 Received: by ug-out-1314.google.com with SMTP id m3so1674441uge for ; Tue, 20 Jun 2006 23:14:00 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=MEItx8Yq+2WLU18htUJ+ocXmYPJzjD1T+HOpIrJmhvd/6i87hA8/nmpn/kn5UYdda5owdiShHTLozOxCjm2m1e+Hn2NoUa6ZsGmNGqafhnUtApvOJsSnoEwoAdE9Kt9gHz9vLkIDEZcIbjZjGC9MET/MFGFjsAR2epinj+F9h+A= Received: by 10.67.19.13 with SMTP id w13mr7364834ugi; Tue, 20 Jun 2006 23:14:00 -0700 (PDT) Received: by 10.66.224.1 with HTTP; Tue, 20 Jun 2006 23:14:00 -0700 (PDT) Message-ID: Date: Wed, 21 Jun 2006 07:14:00 +0100 From: "James Strachan" To: activemq-users@geronimo.apache.org Subject: Re: detaching message group affinity In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4957209.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N BTW a nice way to clean up dead conversations could just be to time them out. On the Lingo project we have a useful Map implementation class which if the key is not used within a time window its evicted from RAM; we could maybe use this with the SimpleMessageGroupMap to clean up conversations after a period of inactivity. http://lingo.codehaus.org/maven/apidocs/org/logicblaze/lingo/util/TimeoutMap.html On 6/21/06, James Strachan wrote: > LOL. No worries - I was being lazy too not showing you how to do it > :). Still glad to hear it was possible for you to figure it out :) > > On 6/21/06, Sanjiv Jivan wrote: > > On 6/21/06, Sanjiv Jivan wrote: > > > > > > > > > > > > On 6/21/06, James Strachan wrote: > > > > > > > > BTW what do you do if the JVM running the conversation dies? > > > > > > > > > If the JVM running the conversation dies, the message group for this > > > converation should fail over to another server where an exception will be > > > raised indicating that the conversation is not recognized on this server. > > > The client will see this exception message and can then restart the > > > conversation against a new server. > > > > > > It sounds like then if you don't want to close a message group (for > > > > fear of closing another message group) then you could consider > > > > > > > > (i) using an alternative MessageGroupMap implementation which doesn't > > > > use hash buckets - this could use lots more RAM if you have a large > > > > number of JMSXGroupID values - and there is the chance of a memory > > > > leak if you keep generating values and don't close them down but you > > > > may be happy to pay that cost > > > > > > > > > > > > http://incubator.apache.org/activemq/maven/activemq-core/apidocs/org/apache/activemq/broker/region/group/MessageGroupMap.html > > > > > > > > i.e. use the SimpleMessageGroupMap rather than the default which uses > > > > hash buckets. > > > > > > > > (ii) to close a conversation, just close the message consumer. > > > > > > > > Maybe you need (i)? > > > > > > > > > Yes, SimpleMessageGroupMap seems like what I need. In my usecase there > > > will not be many conversations (50 atmost) and I will be able to write a > > > cleanup routine to close dead conversations. > > > > > > Is there a top level factory/property I can set using the Spring config > > > (like the connection factory or the destination) to cause it internally use > > > SimpleMessageGroupMap ? > > > > > > > > > > I'll figure this out. Kinda late here and I was getting lazy to dig through > > the source now.. Sorry :) > > > > Thanks, > > > Sanjiv > > > > > > On 6/20/06, Sanjiv Jivan wrote: > > > > > On 6/20/06, James Strachan wrote: > > > > > > > > > > > > On 6/20/06, Thomas Swindells wrote: > > > > > > > James.Strachan wrote: > > > > > > > > > > > > > > > > On 6/19/06, Sanjiv Jivan wrote: > > > > > > > >> > 2. Is there a way to detach a message group affinity to a > > > > > > particular > > > > > > > >> broker. > > > > > > > >> > > > > > > > >> >Just set JMSXGroupSeq to zero on the last message which > > > > 'closes' the > > > > > > > >> >message group so if another message is sent in the future with > > > > the > > > > > > > >> >same group ID it will be reassigned to a new consumer. > > > > > > > >> > > > > > > > >> >message.setIntProperty("JMSXGroupSeq", 0); > > > > > > > >> > > > > > > > >> This would reset all the affinity of all the message groups, > > > > right? > > > > > > > > > > > > > > > > No - just the message group for the JMSXGroupId setting. > > > > > > > > I should have been more clear... to clear message group FOO use > > > > > > > > > > > > > > > > message.setStringProperty("JMSXGroupID", "FOO"); > > > > > > > > message.setIntProperty("JMSXGroupSeq", 0); > > > > > > > > > > > > > > > Reading the Message group page > > > > > > > (http://activemq.org/site/message-groups.html) there is probably a > > > > minor > > > > > > bug > > > > > > > here in that it would close all messsage groups with the same Hash > > > > as > > > > > > "FOO", > > > > > > > although in practice for a well designed system expecting that msg > > > > > > groups > > > > > > > could change this shouldn't be a problem. Of course the chances of > > > > a > > > > > > hash > > > > > > > clash for relatively short group id's is pretty tiny. > > > > > > > > > > > > Yeah - hashing collisions should be fairly unlikely - though its a > > > > RAM > > > > > > v risk tradeoff - the larger the number of hash buckets, the more > > > > RAM > > > > > > used but the less likely a collision. > > > > > > > > > > > > Though worse case a message group is closed and reopened - which > > > > just > > > > > > rebalances the association of message groups to consumers so it > > > > > > doesn't cause much harm (*). > > > > > > > > > > > > > > > This would cause harm if a message group is used as a basis of a > > > > stateful > > > > > conversation with the chosen server (which embeds a broker)which I how > > > > I > > > > > require to use them in my usecase. Is not like a stateless stock quote > > > > > request which any server can respond to.. its more like > > > > > startConversation(A), getResults(A) and if getResults(A) goes to the > > > > wrong > > > > > server, its an error condition since the conversation was started with > > > > > another server. I do not want to get in the business of state > > > > replicating > > > > > servers, just want to partition conversation based load based (rather > > > > that > > > > > individual request based load balancing). > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > James > > > > ------- > > > > http://radio.weblogs.com/0112098/ > > > > > > > > > > > > > > > > > > > > -- > > James > ------- > http://radio.weblogs.com/0112098/ > -- James ------- http://radio.weblogs.com/0112098/