You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Dmtiriy <dm...@gmail.com> on 2016/08/04 13:29:16 UTC

Message Ordering across Networked Brokers

Hi All,
I am a newbie when it comes to networked brokers & active mq and need some
expert help.

I am trying to setup a system where messages order based JMSXGroupID is
preserved across networked brokers and concurrent consumers.  In the use
case i have 2 JVMs that each have 10 concurrent consumers, producers and
embedded broker for the same queue.  Each broker connected to each other via
network connector with duplex disabled.  Each JVM has consumers and
producers that connect to embedded broker via vm:// connection.

There is no data store replication, but store & forward setup.

Is such setup possible?  If not, what would be the best option to achieve
it?

What I am seeing based on my tests so far is that sometime message order
being preserved and sometimes it is not.

<http://activemq.2283324.n4.nabble.com/file/n4715070/image_%283%29.png> 

Thanks in advance,
Dmitriy



--
View this message in context: http://activemq.2283324.n4.nabble.com/Message-Ordering-across-Networked-Brokers-tp4715070.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Message Ordering across Networked Brokers

Posted by Tim Bain <tb...@alumni.duke.edu>.
I haven't used JMSXGroupid myself, so everything I say is based on what
I've read, not what I've done.  With that said...

I believe that JMSXGroupid should be respected across the entire network of
brokers (NoB).  When Broker A allocates a given JMSXGroupid to a given
consumer, I believe that it will let Broker B know about that allocation,
so messages with a JMSXGroupid of 1 that are produced to Broker B should be
forwarded to Broker A rather than delivered to a local consumer on B.  So
ActiveMQ should already be able to give you the ability to deliver all of
those messages to a single consumer.

But having every message go to a single consumer isn't the same as having
all messages go to that consumer in the order in which they were
published.  Like I said in my first email, delivery to a single consumer is
in-order **from the perspective of the broker to which it is connected**.
From Broker A's perspective, a message from Producer 2 on Broker B is
published when the message is published from Broker B to Broker A, not when
it is published from Producer 2 to Broker B.  So all the messages published
directly to Broker A will be in order relative to one another, and all the
messages published to Broker B and then forwarded to Broker A will be in
order relative to one another, but the ordering of the messages in the two
streams relative to one another may not be in the order in which they were
actually produced.

This is both the beauty and the limitation of the ActiveMQ model: the
perspective of any given broker generally spans only that one broker and
the things it can see, but for some features there is no ability to
consider the entire network of brokers.  This is both elegant (because it
allows a simple implementation that still allows you to build arbitrarily
complex networks of brokers) and limiting (because it can be difficult or
impossible to support certain functionality that requires a whole-network
view).

Tim

On Sun, Aug 7, 2016 at 6:54 AM, Dmtiriy <dm...@gmail.com> wrote:

> I guess what I was trying to ask is that if BrokerA on JVM1 registers a
> consumer on Queue-1 w/ JMSXGroupid of 1, can networked BrokerB on JVM2
> register a different consumer on same Queue-1 w/ same JMSXGroupid of 1.  Do
> networked brokers have a way to preserve single consumer per unique
> JMSXGroupid and therefore order across network brokers?
>
> You kind of answered that question already that order not preserved across
> network brokers even when JMSXGroupid is used and based on my tests with
> multiple consumers per JMSXGroupid (1 consumer per broker per jvm per
> JMSXGroupid)
>
> What is the best approach to preserve message order across embedded
> brokers?
> Is master/slave setup w/ replicated data store a better option in this case
> or some type of distributed queue setup?
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.
> nabble.com/Message-Ordering-across-Networked-Brokers-
> tp4715070p4715110.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: Message Ordering across Networked Brokers

Posted by Dmtiriy <dm...@gmail.com>.
I guess what I was trying to ask is that if BrokerA on JVM1 registers a
consumer on Queue-1 w/ JMSXGroupid of 1, can networked BrokerB on JVM2
register a different consumer on same Queue-1 w/ same JMSXGroupid of 1.  Do
networked brokers have a way to preserve single consumer per unique
JMSXGroupid and therefore order across network brokers?

You kind of answered that question already that order not preserved across
network brokers even when JMSXGroupid is used and based on my tests with
multiple consumers per JMSXGroupid (1 consumer per broker per jvm per
JMSXGroupid)

What is the best approach to preserve message order across embedded brokers? 
Is master/slave setup w/ replicated data store a better option in this case
or some type of distributed queue setup?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Message-Ordering-across-Networked-Brokers-tp4715070p4715110.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Message Ordering across Networked Brokers

Posted by Tim Bain <tb...@alumni.duke.edu>.
Are you saying that multiple consumers are getting messages for the same
message group?  That shouldn't happen.

Also, what does "message order being preserved" (or nor) mean in this
context?  ActiveMQ doesn't guarantee ordering across a network of brokers,
only from the perspective of a single broker, so if Broker A is forwarding
messages to Broker B while a producer is producing directly to B, B will
order the messages based on when B received them, not when they were
originally produced.

Tim

On Aug 4, 2016 2:45 PM, "Dmtiriy" <dm...@gmail.com> wrote:

> Forgot to mention that under ideal scenario I was hoping to consistently
> see
> messages go to the same single consumer on either of the JVMs that
> registers
> itself against same JMSXGroupId irrespective where the producer is.
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.
> nabble.com/Message-Ordering-across-Networked-Brokers-
> tp4715070p4715071.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: Message Ordering across Networked Brokers

Posted by Dmtiriy <dm...@gmail.com>.
Forgot to mention that under ideal scenario I was hoping to consistently see
messages go to the same single consumer on either of the JVMs that registers
itself against same JMSXGroupId irrespective where the producer is.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Message-Ordering-across-Networked-Brokers-tp4715070p4715071.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.