You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by ripienaar <ri...@devco.net> on 2010/07/24 16:23:18 UTC

Correct way to build a mesh of brokers

Hello,

I am trying to create a redundant network of brokers using 3 activemq
instances.

I would ideally have redundant connections like:

- A to B
- A to C
- B to A
- B to C
- C to A 
- C to B

This is a typical mesh, can be made simpler if I am able to use duplex
connections:

- A duplex to B
- A duplex to C
- B duplex to C

The problem I have is that if I create a setup like this I always get
duplicate messages on topic,

All the machines have blocks resembling this:

        <networkConnectors>
          <networkConnector name="dev3-dev2" uri="static:(tcp://dev2:6166)"
userName="amq" password="xx" suppressDuplicateQueueSubscriptions="true"
networkTTL="2"/>
          <networkConnector name="dev3-dev1" uri="static:(tcp://dev3:6166)"
userName="amq" password="xx" suppressDuplicateQueueSubscriptions="true"
networkTTL="2"/>
        </networkConnectors>

Have also tried the simpler full duplex version with similar results.

And I have unique broker names.

If I now add a subscription on each of the 3 nodes to a topic /topic/foo and
send a message then I will get duplicates delivered to some of the
subscribers.

so my question is:

a) is this kind of thing possible, can I create meshes with routing loops
b) whats the right way?

-- 
View this message in context: http://old.nabble.com/Correct-way-to-build-a-mesh-of-brokers-tp29255162p29255162.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Correct way to build a mesh of brokers

Posted by Gary Tully <ga...@gmail.com>.
the audits use an LRU cache for producers so the memory usage should
level out with load once the limits are reached.


On 30 July 2010 00:31, ripienaar <ri...@devco.net> wrote:
>
> I am also seeing a memory growth as reported by the statisticsBrokerPlugin
>
> http://78.47.195.198/~rip/mesh-memory.png
>
> I am guessing this might be the audit feature keeping track of messages it's
> seen? hard to say but all my brokers show this growth curve.  I am not doing
> any queue based work on these machines its all topics.
> --
> View this message in context: http://old.nabble.com/Correct-way-to-build-a-mesh-of-brokers-tp29255162p29301562.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>



-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com

Re: Correct way to build a mesh of brokers

Posted by ripienaar <ri...@devco.net>.
I am also seeing a memory growth as reported by the statisticsBrokerPlugin 

http://78.47.195.198/~rip/mesh-memory.png

I am guessing this might be the audit feature keeping track of messages it's
seen? hard to say but all my brokers show this growth curve.  I am not doing
any queue based work on these machines its all topics.
-- 
View this message in context: http://old.nabble.com/Correct-way-to-build-a-mesh-of-brokers-tp29255162p29301562.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Correct way to build a mesh of brokers

Posted by ripienaar <ri...@devco.net>.


Dejan Bosanac wrote:
> 
> Hm, this sounds like
> https://issues.apache.org/activemq/browse/AMQ-2782 which is also fixed
> in the trunk.
> 
> Can you check out this test
> 
> http://fisheye6.atlassian.com/browse/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerStompTemporaryQueueTest.java?r=HEAD
> 

I'm running a version with this applied already - I installed last nights
SNAPSHOT for 5.4.0.

Not really sure how to run java tests, if someone can give me hints I can
try.

-- 
View this message in context: http://old.nabble.com/Correct-way-to-build-a-mesh-of-brokers-tp29255162p29303640.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Correct way to build a mesh of brokers

Posted by Dejan Bosanac <de...@nighttale.net>.
Hm, this sounds like
https://issues.apache.org/activemq/browse/AMQ-2782 which is also fixed
in the trunk.

Can you check out this test

http://fisheye6.atlassian.com/browse/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerStompTemporaryQueueTest.java?r=HEAD

Cheers
--
Dejan Bosanac - http://twitter.com/dejanb

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net



On Fri, Jul 30, 2010 at 12:21 AM, ripienaar <ri...@devco.net> wrote:
>
>
>
> Gary Tully wrote:
>>
>> for future reference, the ordering of elements in the broker sequence
>> is alphabetical - <plugins> before <transportConnectors> and the
>> difference with 5.4 is that the xml configuration file is validated
>> against the schema. It was always alphabetical, just never enforced.
>>
>
> that's quite interesting, read quite a lot of the wiki and the book and
> first I come across this.  Might have missed it butt his seem like a pretty
> fundemantal bit of info.
>
> So I have 3 x 5.40 instances now running doing ~ 1/2 million messages a day.
> They're meshed as per our discussion above.
>
> My only remaining hassle is that any kind of temp topic use via stomp -
> /temp-topic/foo - results in a whole slew of advisory messages - 300 000 / 5
> minutes - so I am guessing somewhere something is still not auditing them.
>
> I have this:
>
>        <destinationPolicy>
>          <policyMap>
>            <policyEntries>
>              <policyEntry topic=">" />
>            </policyEntries>
>          </policyMap>
>        </destinationPolicy>
>
> but that might not apply to temp topics?  Is there a similar trick, I see
> http://activemq.apache.org/per-destination-policies.html mentions
> tempTopic=true but I do not see it mentioned in the docs to tell me what
> that actually does.
>
> any hints welcome
> --
> View this message in context: http://old.nabble.com/Correct-way-to-build-a-mesh-of-brokers-tp29255162p29301215.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

Re: Correct way to build a mesh of brokers

Posted by ripienaar <ri...@devco.net>.


Gary Tully wrote:
> 
> for future reference, the ordering of elements in the broker sequence
> is alphabetical - <plugins> before <transportConnectors> and the
> difference with 5.4 is that the xml configuration file is validated
> against the schema. It was always alphabetical, just never enforced.
> 

that's quite interesting, read quite a lot of the wiki and the book and
first I come across this.  Might have missed it butt his seem like a pretty
fundemantal bit of info.

So I have 3 x 5.40 instances now running doing ~ 1/2 million messages a day. 
They're meshed as per our discussion above.

My only remaining hassle is that any kind of temp topic use via stomp -
/temp-topic/foo - results in a whole slew of advisory messages - 300 000 / 5
minutes - so I am guessing somewhere something is still not auditing them.

I have this:

        <destinationPolicy>
          <policyMap>
            <policyEntries>
              <policyEntry topic=">" />
            </policyEntries>
          </policyMap>
        </destinationPolicy>

but that might not apply to temp topics?  Is there a similar trick, I see
http://activemq.apache.org/per-destination-policies.html mentions
tempTopic=true but I do not see it mentioned in the docs to tell me what
that actually does.

any hints welcome
-- 
View this message in context: http://old.nabble.com/Correct-way-to-build-a-mesh-of-brokers-tp29255162p29301215.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Correct way to build a mesh of brokers

Posted by Gary Tully <ga...@gmail.com>.
for future reference, the ordering of elements in the broker sequence
is alphabetical - <plugins> before <transportConnectors> and the
difference with 5.4 is that the xml configuration file is validated
against the schema. It was always alphabetical, just never enforced.

On 26 July 2010 19:31, ripienaar <ri...@devco.net> wrote:
>
>
>
> ripienaar wrote:
>>
>> The configs for 5.3.2 is not compatible with 5.4, I'd say that renders 5.4
>> useless and I cannot test.  Given the state of the documentation, it
>> really is an unresolvable issue at this point for me.
>>
>> The XML config seem to have a fairly random behavior wrt ordering, what
>> works in 5.3.x doesnt work in 5.4-SNAPSHOT etc, the errors - pages full of
>> "meaningful" exceptions does not help.
>>
>
> Ordering issues seems to be related to the <plugins> section, it cannot now
> be after <transportConnectors>.
>
> With that sorted the dupes are gone in 5.4-SNAPSHOT.
>
> Does anyone have any view on when 5.4 might be out?
> --
> View this message in context: http://old.nabble.com/Correct-way-to-build-a-mesh-of-brokers-tp29255162p29269460.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>



-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com

How to secure ActiveMQ admin console, running inside JBoss

Posted by Ha...@gpj.com.
I am trying to secure ActiveMQ web console running inside JBoss. What is 
the best way of doing it? I have an activemq-web-console.war file that i 
have deployed on JBoss. The
queue is running fine with the JBoss start up , but now I want to secure 
access to the admin console.


Thanks!
Hammad

Re: Correct way to build a mesh of brokers

Posted by Rob Davies <ra...@gmail.com>.
That ordering issue is a pita - appologies - 5.4 should be out next week

cheers,

Rob
On 26 Jul 2010, at 19:31, ripienaar wrote:

> 
> 
> 
> ripienaar wrote:
>> 
>> The configs for 5.3.2 is not compatible with 5.4, I'd say that renders 5.4
>> useless and I cannot test.  Given the state of the documentation, it
>> really is an unresolvable issue at this point for me.
>> 
>> The XML config seem to have a fairly random behavior wrt ordering, what
>> works in 5.3.x doesnt work in 5.4-SNAPSHOT etc, the errors - pages full of
>> "meaningful" exceptions does not help.
>> 
> 
> Ordering issues seems to be related to the <plugins> section, it cannot now
> be after <transportConnectors>.
> 
> With that sorted the dupes are gone in 5.4-SNAPSHOT.
> 
> Does anyone have any view on when 5.4 might be out?
> -- 
> View this message in context: http://old.nabble.com/Correct-way-to-build-a-mesh-of-brokers-tp29255162p29269460.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> 


Re: Correct way to build a mesh of brokers

Posted by ripienaar <ri...@devco.net>.


ripienaar wrote:
> 
> The configs for 5.3.2 is not compatible with 5.4, I'd say that renders 5.4
> useless and I cannot test.  Given the state of the documentation, it
> really is an unresolvable issue at this point for me.
> 
> The XML config seem to have a fairly random behavior wrt ordering, what
> works in 5.3.x doesnt work in 5.4-SNAPSHOT etc, the errors - pages full of
> "meaningful" exceptions does not help.
> 

Ordering issues seems to be related to the <plugins> section, it cannot now
be after <transportConnectors>.

With that sorted the dupes are gone in 5.4-SNAPSHOT.

Does anyone have any view on when 5.4 might be out?
-- 
View this message in context: http://old.nabble.com/Correct-way-to-build-a-mesh-of-brokers-tp29255162p29269460.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Correct way to build a mesh of brokers

Posted by ripienaar <ri...@devco.net>.


ripienaar wrote:
> 
> 
> 
> Gary Tully wrote:
>> 
>> sorry, yes, having only half of them duplex will do it. I neglected to
>> ask what version you have, in any event, the issue referenced in the
>> last message (AMQ-2704) was recently resolved so you need to try a
>> 5.4-SNAPSHOT to get the benefit.
>> 
> 
> I am on 5.3.2, will try with a snapshot.
> 

The configs for 5.3.2 is not compatible with 5.4, I'd say that renders 5.4
useless and I cannot test.  Given the state of the documentation, it really
is an unresolvable issue at this point for me.

The XML config seem to have a fairly random behavior wrt ordering, what
works in 5.3.x doesnt work in 5.4-SNAPSHOT etc, the errors - pages full of
"meaningful" exceptions does not help.
-- 
View this message in context: http://old.nabble.com/Correct-way-to-build-a-mesh-of-brokers-tp29255162p29268960.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Correct way to build a mesh of brokers

Posted by ripienaar <ri...@devco.net>.


Gary Tully wrote:
> 
> sorry, yes, having only half of them duplex will do it. I neglected to
> ask what version you have, in any event, the issue referenced in the
> last message (AMQ-2704) was recently resolved so you need to try a
> 5.4-SNAPSHOT to get the benefit.
> 

I am on 5.3.2, will try with a snapshot.
-- 
View this message in context: http://old.nabble.com/Correct-way-to-build-a-mesh-of-brokers-tp29255162p29268323.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Correct way to build a mesh of brokers

Posted by Gary Tully <ga...@gmail.com>.
sorry, yes, having only half of them duplex will do it. I neglected to
ask what version you have, in any event, the issue referenced in the
last message (AMQ-2704) was recently resolved so you need to try a
5.4-SNAPSHOT to get the benefit.

On 26 July 2010 17:10, ripienaar <ri...@devco.net> wrote:
>
>
>
> Gary Tully wrote:
>>
>> you need to turn duplex off or only create the bridges from one
>> broker. With your config, where every broker is connected to every
>> other broker, duplex=true causes every broker to be connected twice to
>> every other broker!
>>
>> duplex is handy in a hub-spoke topology where the spoke initiates the
>> forwarding bridge in duplex mode, negating the need for the hub to be
>> ware of the spoke.
>>
>
> I have tried both, but will try again.
>
> If you look closely though I do not connect duplexes from every node in the
> config on the pastie.
>
> dev1 duplex -> dev2
> dev1 duplex -> dev3
>
> dev2 duplex -> dev3
>
> those are the only duplex connections, I believe that is identical to making
> a full mesh with non duplex connections, as duplex will just have it setup
> the back bridge for you?  There would be no multiple connections.
>
> On reconfiguring it as you describe:
>
> dev1 -> dev2
> dev1 -> dev3
> dev2 -> dev1
> dev2 -> dev3
> dev3 -> dev1
> dev3 -> dev2
>
> All non duplex, same behavior.
>
> Current config on dev1 http://www.pastie.org/1060682 dev2 and 3 is similar
> just the connections change.
> --
> View this message in context: http://old.nabble.com/Correct-way-to-build-a-mesh-of-brokers-tp29255162p29268175.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>



-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com

Re: Correct way to build a mesh of brokers

Posted by ripienaar <ri...@devco.net>.


Gary Tully wrote:
> 
> you need to turn duplex off or only create the bridges from one
> broker. With your config, where every broker is connected to every
> other broker, duplex=true causes every broker to be connected twice to
> every other broker!
> 
> duplex is handy in a hub-spoke topology where the spoke initiates the
> forwarding bridge in duplex mode, negating the need for the hub to be
> ware of the spoke.
> 

I have tried both, but will try again.

If you look closely though I do not connect duplexes from every node in the
config on the pastie.

dev1 duplex -> dev2
dev1 duplex -> dev3

dev2 duplex -> dev3

those are the only duplex connections, I believe that is identical to making
a full mesh with non duplex connections, as duplex will just have it setup
the back bridge for you?  There would be no multiple connections.

On reconfiguring it as you describe:

dev1 -> dev2
dev1 -> dev3
dev2 -> dev1
dev2 -> dev3
dev3 -> dev1
dev3 -> dev2

All non duplex, same behavior.

Current config on dev1 http://www.pastie.org/1060682 dev2 and 3 is similar
just the connections change.
-- 
View this message in context: http://old.nabble.com/Correct-way-to-build-a-mesh-of-brokers-tp29255162p29268175.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Correct way to build a mesh of brokers

Posted by Gary Tully <ga...@gmail.com>.
you need to turn duplex off or only create the bridges from one
broker. With your config, where every broker is connected to every
other broker, duplex=true causes every broker to be connected twice to
every other broker!

duplex is handy in a hub-spoke topology where the spoke initiates the
forwarding bridge in duplex mode, negating the need for the hub to be
ware of the spoke.

On 26 July 2010 16:41, ripienaar <ri...@devco.net> wrote:
>
>
>
> Gary Tully wrote:
>>
>> ok, so you need to set networTTL=2 for your 3 broker mesh (two hops
>> will get to any broker) and enable audit for your topics by explicitly
>> setting a topic destination policy. <policyEntry topic=">" />
>> See the relevant test case: testAllConnectedBrokerNetworkSingleProducerTTL
>> in
>> http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkTest.java?view=log
>>
>> and: https://issues.apache.org/activemq/browse/AMQ-2704 for some more
>> detail
>>
>> If there is still a problem, maybe take ThreeBrokerTopicNetworkTest
>> for a whirl and add your scenario to it.
>>
>
> Unfortunately I dont know a whole lot of Java so running test cases and
> adding test cases perhaps a bit above what I can do...
>
> I have tried these options as per pastie: http://www.pastie.org/1060648
>
> Still duplicates, I've tried several permutations:
>
> - not using duplex, creating the mesh connections all by hand with static
> connections
> - tried to move the order of the policy maps above connectos and network
> connections rather than below.
>
> All results in dupes.
> --
> View this message in context: http://old.nabble.com/Correct-way-to-build-a-mesh-of-brokers-tp29255162p29267890.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>



-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com

Re: Correct way to build a mesh of brokers

Posted by ripienaar <ri...@devco.net>.


Gary Tully wrote:
> 
> ok, so you need to set networTTL=2 for your 3 broker mesh (two hops
> will get to any broker) and enable audit for your topics by explicitly
> setting a topic destination policy. <policyEntry topic=">" />
> See the relevant test case: testAllConnectedBrokerNetworkSingleProducerTTL
> in
> http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkTest.java?view=log
> 
> and: https://issues.apache.org/activemq/browse/AMQ-2704 for some more
> detail
> 
> If there is still a problem, maybe take ThreeBrokerTopicNetworkTest
> for a whirl and add your scenario to it.
> 

Unfortunately I dont know a whole lot of Java so running test cases and
adding test cases perhaps a bit above what I can do...

I have tried these options as per pastie: http://www.pastie.org/1060648

Still duplicates, I've tried several permutations:

- not using duplex, creating the mesh connections all by hand with static
connections
- tried to move the order of the policy maps above connectos and network
connections rather than below.

All results in dupes.
-- 
View this message in context: http://old.nabble.com/Correct-way-to-build-a-mesh-of-brokers-tp29255162p29267890.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Correct way to build a mesh of brokers

Posted by Gary Tully <ga...@gmail.com>.
ok, so you need to set networTTL=2 for your 3 broker mesh (two hops
will get to any broker) and enable audit for your topics by explicitly
setting a topic destination policy. <policyEntry topic=">" />
See the relevant test case: testAllConnectedBrokerNetworkSingleProducerTTL in
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkTest.java?view=log

and: https://issues.apache.org/activemq/browse/AMQ-2704 for some more detail

If there is still a problem, maybe take ThreeBrokerTopicNetworkTest
for a whirl and add your scenario to it.

On 26 July 2010 12:10, ripienaar <ri...@devco.net> wrote:
>
>
>
> Gary Tully wrote:
>>
>> set decreaseNetworkConsumerPriority=true because the topic duplicate
>> suppression logic depends on priority to remove a duplicate network
>> subscription.
>>
>
>
> Thanks for your reply, have tried this before, tried again now this is the
> setup from one of the 3:
>
>        <networkConnectors>
>          <networkConnector name="dev3-dev1"
> uri="static:(tcp://dev1.xx.net:6166)" networkTTL="3" duplex="false"
> decreaseNetworkConsumerPriority="true"/>
>          <networkConnector name="dev3-dev2"
> uri="static:(tcp://dev1.xx.net:6166)" networkTTL="3" duplex="false"
> decreaseNetworkConsumerPriority="true"/>
>        </networkConnectors>
>
> I've removed all the authentication and authorization from the 3 brokers as
> well just in case, a full config from one of them:
> http://www.pastie.org/1060266
>
> The others just mirror it.
>
> So with a consumer on dev1, dev2 and dev3 to /topic/foo and producing a
> message to the topic on dev3 then dev2 and 1 will both get the message
> twice.
> --
> View this message in context: http://old.nabble.com/Correct-way-to-build-a-mesh-of-brokers-tp29255162p29265342.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>



-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com

Re: Correct way to build a mesh of brokers

Posted by ripienaar <ri...@devco.net>.


Gary Tully wrote:
> 
> set decreaseNetworkConsumerPriority=true because the topic duplicate
> suppression logic depends on priority to remove a duplicate network
> subscription.
> 


Thanks for your reply, have tried this before, tried again now this is the
setup from one of the 3:

        <networkConnectors>
          <networkConnector name="dev3-dev1"
uri="static:(tcp://dev1.xx.net:6166)" networkTTL="3" duplex="false"
decreaseNetworkConsumerPriority="true"/>
          <networkConnector name="dev3-dev2"
uri="static:(tcp://dev1.xx.net:6166)" networkTTL="3" duplex="false"
decreaseNetworkConsumerPriority="true"/>
        </networkConnectors>

I've removed all the authentication and authorization from the 3 brokers as
well just in case, a full config from one of them:
http://www.pastie.org/1060266

The others just mirror it.

So with a consumer on dev1, dev2 and dev3 to /topic/foo and producing a
message to the topic on dev3 then dev2 and 1 will both get the message
twice.
-- 
View this message in context: http://old.nabble.com/Correct-way-to-build-a-mesh-of-brokers-tp29255162p29265342.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Correct way to build a mesh of brokers

Posted by Gary Tully <ga...@gmail.com>.
set decreaseNetworkConsumerPriority=true because the topic duplicate
suppression logic depends on priority to remove a duplicate network
subscription.

On 24 July 2010 15:35, ripienaar <ri...@devco.net> wrote:
>
> I should also add that with the TTL set to 1 this works in the usual case
> where everything is up, but should a connection die messages will need to
> travel 2 hops to make it to the furthest edge of the network.  If I set it
> to 2 like below I get dupes when all links are established.
>
>
>
> ripienaar wrote:
>>
>> Hello,
>>
>> I am trying to create a redundant network of brokers using 3 activemq
>> instances.
>>
>> I would ideally have redundant connections like:
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Correct-way-to-build-a-mesh-of-brokers-tp29255162p29255218.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>



-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com

Re: Correct way to build a mesh of brokers

Posted by ripienaar <ri...@devco.net>.
I should also add that with the TTL set to 1 this works in the usual case
where everything is up, but should a connection die messages will need to
travel 2 hops to make it to the furthest edge of the network.  If I set it
to 2 like below I get dupes when all links are established.



ripienaar wrote:
> 
> Hello,
> 
> I am trying to create a redundant network of brokers using 3 activemq
> instances.
> 
> I would ideally have redundant connections like:
> 
> 

-- 
View this message in context: http://old.nabble.com/Correct-way-to-build-a-mesh-of-brokers-tp29255162p29255218.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.