Network of brokers: problem with duplex="false" for static bridges

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Network of brokers: problem with duplex="false" for static bridges

jochenw
Hello,

I have a configuration where one broker builds network connections to other brokers. Some of the queues have to be two-way (duplex="true") and some have to be one-way (duplex="false"). For the network connector configuration, see below. The ActiveMQ version is 5.14.5.

The goal is that queue1 and topic1 are visible in all brokers, since the consumer is connected to broker1, the producers to broker2 and broker3. For the queues with the name queue2.<ID>, the producer is connected to broker1, the consumers to broker2 or broker3. This bridge has duplex="false", because these queues should be visible in broker1 and the broker to which the consumer is connected, but not the other broker. E.g.: The consumer for queue2.abc is in broker2, so this queue should only be visible in broker1 (where the producer is) and broker2, the consumer for queue2.edf is in broker3, so this one should only be visible in broker1 and broker3.

Now the problem: when sending a message to queue2.abc, sometimes it arrives at broker2 and is correctly consumerd there. But sometimes the message arrives at broker3, and the Web console of broker3 shows that queue2.abc is created there and a message enqueued. Although the queue has zero consumers, after few seconds it is consumed from there, but nothing else happens. Possibly, the message goes to broker2 (where it originally was meant to go), but then dies due to networkTTL="3".

When I used a dynamic bridge and dynamicallyIncludedDestinations and activate the advisorySupport for all involved brokers, all works correctly.

So the question is whether with static bridges, the duplex="false" clause should work. With this, queue2.abc should never be synced to broker3, but obviously the messages appear at broker3 anyways.

Regards,
Jochen


Network connector configuration snippet from activemq.xml of broker1 (for the test configuration, all brokers are running on the same host in docker containers with 61616 mapped to different ports):

<networkConnectors>
    <networkConnector uri="static:(failover:(tcp://myhost:62616)?maxReconnectAttempts=0)"
                        name="broker1_broker2_duplex"
        duplex="true"
        networkTTL="3"
        staticBridge="true">
        <staticallyIncludedDestinations>
            <queue physicalName="queue1"/>
            <topic physicalName="topic1"/>
        </staticallyIncludedDestinations>
    </networkConnector>
   
    <networkConnector uri="static:(failover:(tcp://myhost:62616)?maxReconnectAttempts=0)"
                        name="broker1_broker2_simplex"
        duplex="false"
        networkTTL="3"
        staticBridge="true">
        <staticallyIncludedDestinations>
                <queue physicalName="queue2.>"/>
        </staticallyIncludedDestinations>
    </networkConnector>

    <networkConnector uri="static:(failover:(tcp://myhost:63616)?maxReconnectAttempts=0)"
                        name="broker1_broker3_duplex"
        duplex="true"
        networkTTL="3"
        staticBridge="true">
        <staticallyIncludedDestinations>
            <queue physicalName="queue1"/>
            <topic physicalName="topic1"/>
        </staticallyIncludedDestinations>
    </networkConnector>
   
    <networkConnector uri="static:(failover:(tcp://myhost:63616)?maxReconnectAttempts=0)"
                        name="broker1_broker3_simplex"
        duplex="false"
        networkTTL="3"
        staticBridge="true">
        <staticallyIncludedDestinations>
                <queue physicalName="queue2.>"/>
        </staticallyIncludedDestinations>
    </networkConnector>
</networkConnectors>


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Network of brokers: problem with duplex="false" for static bridges

jkorab
This post has NOT been accepted by the mailing list yet.
Hi,

What you are seeing makes sense. StaticallyIncludedDestinations pushes messages across the bridge regardless if there is a consumer there or not. The two networkConnectors in your situation act as competing consumers and have messages round-robined between them.

For broker1_broker3_simplex and broker1_broker2_simplex your configuration should look as per:

<networkConnector uri="..."
    name="broker1_broker2_simplex"
    duplex="false">
  <dynamicallyIncludedDestinations>
    <queue physicalName="queue2.>"/>
  </dynamicallyIncludedDestinations>
</networkConnector>

<networkConnector uri="..."
    name="broker1_broker3_simplex"
    duplex="false">
  <dynamicallyIncludedDestinations>
    <queue physicalName="queue2.>"/>
  </dynamicallyIncludedDestinations>
</networkConnector>

That way, messages only get pulled across the appropriate networkConnector if there is demand (i.e. a consumer) on the other side.

Jakub

On Wed, Jun 28, 2017 at 8:11 AM, jochenw [via ActiveMQ] <[hidden email]> wrote:
Hello,

I have a configuration where one broker builds network connections to other brokers. Some of the queues have to be two-way (duplex="true") and some have to be one-way (duplex="false"). For the network connector configuration, see below. The ActiveMQ version is 5.14.5.

The goal is that queue1 and topic1 are visible in all brokers, since the consumer is connected to broker1, the producers to broker2 and broker3. For the queues with the name queue2.<ID>, the producer is connected to broker1, the consumers to broker2 or broker3. This bridge has duplex="false", because these queues should be visible in broker1 and the broker to which the consumer is connected, but not the other broker. E.g.: The consumer for queue2.abc is in broker2, so this queue should only be visible in broker1 (where the producer is) and broker2, the consumer for queue2.edf is in broker3, so this one should only be visible in broker1 and broker3.

Now the problem: when sending a message to queue2.abc, sometimes it arrives at broker2 and is correctly consumerd there. But sometimes the message arrives at broker3, and the Web console of broker3 shows that queue2.abc is created there and a message enqueued. Although the queue has zero consumers, after few seconds it is consumed from there, but nothing else happens. Possibly, the message goes to broker2 (where it originally was meant to go), but then dies due to networkTTL="3".

When I used a dynamic bridge and dynamicallyIncludedDestinations and activate the advisorySupport for all involved brokers, all works correctly.

So the question is whether with static bridges, the duplex="false" clause should work. With this, queue2.abc should never be synced to broker3, but obviously the messages appear at broker3 anyways.

Regards,
Jochen


Network connector configuration snippet from activemq.xml of broker1 (for the test configuration, all brokers are running on the same host in docker containers with 61616 mapped to different ports):

<networkConnectors>
    <networkConnector uri="static:(failover:(tcp://myhost:62616)?maxReconnectAttempts=0)"
                        name="broker1_broker2_duplex"
        duplex="true"
        networkTTL="3"
        staticBridge="true">
        <staticallyIncludedDestinations>
            <queue physicalName="queue1"/>
            <topic physicalName="topic1"/>
        </staticallyIncludedDestinations>
    </networkConnector>
   
    <networkConnector uri="static:(failover:(tcp://myhost:62616)?maxReconnectAttempts=0)"
                        name="broker1_broker2_simplex"
        duplex="false"
        networkTTL="3"
        staticBridge="true">
        <staticallyIncludedDestinations>
                <queue physicalName="queue2.>"/>
        </staticallyIncludedDestinations>
    </networkConnector>

    <networkConnector uri="static:(failover:(tcp://myhost:63616)?maxReconnectAttempts=0)"
                        name="broker1_broker3_duplex"
        duplex="true"
        networkTTL="3"
        staticBridge="true">
        <staticallyIncludedDestinations>
            <queue physicalName="queue1"/>
            <topic physicalName="topic1"/>
        </staticallyIncludedDestinations>
    </networkConnector>
   
    <networkConnector uri="static:(failover:(tcp://myhost:63616)?maxReconnectAttempts=0)"
                        name="broker1_broker3_simplex"
        duplex="false"
        networkTTL="3"
        staticBridge="true">
        <staticallyIncludedDestinations>
                <queue physicalName="queue2.>"/>
        </staticallyIncludedDestinations>
    </networkConnector>
</networkConnectors>





If you reply to this email, your message will be added to the discussion below:
http://activemq.2283324.n4.nabble.com/Network-of-brokers-problem-with-duplex-false-for-static-bridges-tp4727986.html
To unsubscribe from ActiveMQ - User, click here.
NAML

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Network of brokers: problem with duplex="false" for static bridges

jochenw
Hi Jakub,

thanks for the explanation! I was not aware that this even overrides the duplex="false" setting. But thinking about it again, it makes sense, since the duplex setting is relevant for the sync direction of consumers, not for the push direction / filtering of messages.

So no other way than using dynamic bridges, at least for the one-way network connectors.

Regards,
Jochen
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Network of brokers: problem with duplex="false" for static bridges

Tim Bain
You've misunderstood the duplex setting. Setting the 1-2 link as simplex
from the 1 side means that messages can go from 1 to 2 but not from 2 to 1
(unless you define a reciprocal connection in the 2 broker, but we're not
considering that case here). It has nothing to do with applying a condition
(consumer is present) to whether messages should be forwarded from 1 to 2,
and therefore nothing is being overridden.

But Jakub is exactly right about the correct way to get the behavior you
want.

Tim

On Jun 29, 2017 1:24 AM, "jochenw" <[hidden email]> wrote:

> Hi Jakub,
>
> thanks for the explanation! I was not aware that this even overrides the
> duplex="false" setting. But thinking about it again, it makes sense, since
> the duplex setting is relevant for the sync direction of consumers, not for
> the push direction / filtering of messages.
>
> So no other way than using dynamic bridges, at least for the one-way
> network
> connectors.
>
> Regards,
> Jochen
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.
> nabble.com/Network-of-brokers-problem-with-duplex-false-for-
> static-bridges-tp4727986p4728049.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Network of brokers: problem with duplex="false" for static bridges

jochenw
Hi Tim,

thanks for clarifying this. I may have expressed it not precisely in my answer: the problem exactly was that for the broker1_broker2_simplex bridge, when sending messages to a queue which is initially only known by broker 2 (because only there a consumer exists for this queue), sometimes doesn't go 1 -> 2, but goes 1 -> 3. Which is clear, since for a static bridge, broker 1 doesn't know which broker has the consumer, and since the includes conatin a wildcard, it will just use round robin to send the messages to the connected brokers.

So it's not about the duplex=false, but it's about the static bridge. When using dynamic bridges as proposed, everything works fine.

Regards,
Jochen
Loading...