activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Message Groups and multiple brokers
Date Tue, 06 Feb 2007 09:55:22 GMT
On 2/6/07, GaryG <ggiventa@us.ibm.com> wrote:
>
> I started playing around with Message Groups and have a bunch of new
> questions:
>
> 1.  If I'm understanding this correctly, Message Groups are tying groupIDs
> to a specific consumer of the Queue.  However, this mapping is private to
> the broker.  So, the problem I'm seeing is that if I run 2 brokers, and my
> URL is something like this:
> url = "failover:(tcp://localhost:61616,tcp://localhost:62616)
>
> Then I send a bunch of messages that are targeted for msgGroupId=1 or 2 or
> 3, and I have 3 consumers running.  Ideally what should happen is that each
> consumer should get an equal share of messages.  And indeed I see this
> behavior with only 1 broker.  But with 2 brokers, I don't see this happen,
> only 1 consumer gets all the messages.   Am I missing something??
>
> I have persistence turned off in this case.
>
> Does this mean that MessageGroups only work when there's only one broker,
> and don't work in Master-Slave broker configuration??

They work with a single broker or with Master-Slave. But they don't
work with networks of brokers.


> 2.  Similar example to the above, but only 1 broker, 3 consumers.  I start
> the message sender, and start seeing the messages spread out across the
> consumers.  Then I kill one of the consumers.  One of the 2 remaining
> consumers picks up the slack.  All is good.
>
> Now I turn the killed consumer back on, and herein lays the problem.  I
> never see this consumer get any messages.  I've tried the suggested method
> of closing the message group with this code:
>
> System.out.println("closing messageGroupId="+msgGroupId);
>       Message message = session.createTextMessage("reset");
>       message.setStringProperty("JMSXGroupID", msgGroupId);
>       message.setIntProperty("JMSXGroupSeq", 0);
>
>       producer.send(message);
>
> But even after I do this, the 3rd consumer never gets any messages, they
> continue going to one of the other guys.
>
> So the question is...if one of the consumers dies, and then comes back
> (common scenario), how do I get the broker to forward messages to him once
> again??

We don't automatically rebalance things after failures; we're
currently hoping that there is a sufficient number of message groups
around that things balance fine. (Though closing the message group
should work - its just not defined which consumer will get the next
message group - so if you keep trying to close them, you should
eventually see things settle down).

One work around is to just force each consumer to restart periodically
to help re-balance things (or close the message groups as you figured
out)
-- 

James
-------
http://radio.weblogs.com/0112098/

Mime
View raw message