You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by hh_meta <he...@tvworks.com> on 2007/06/14 22:54:29 UTC

network of broker does not work properly where there are more than 1 message producer

I tried to configure a network of broker for distributed queue within Spring
2.0. 
So I have 4 brokers in total:
Broker1 and Broker2,  both have a message producer on them;
Broker3 and Broker4,  both have a message consumer on them.
The idea is message produced from either Broker1 and Broker2 will be passed
to consumers on Broker3 or Broker4, load-balanced and supports failover.
here is the activemq.xml for all these brokers, each broker uses a different
tcp port # since I run all 4 brokers on one machine, and I'm using ActiveMQ
4.1.1 release:
<beans>
  <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
  <broker name="embedded_broker" useJmx="false" 
xmlns="http://activemq.org/config/1.0" persistent="false" 
destroy-method="stop">
 
<!-- define a discovery uri for dynamic broker lookup --> 
<!-- prefetch is set to 1 to make sure load balancing during 1:1 testing, we
should change that in production env for better performance -->
    <transportConnectors>
      <transportConnector
uri="tcp://localhost:16163?jms.prefetchPolicy.queuePrefetch=1"
discoveryUri="multicast://myBrokerNetwork"/>
    </transportConnectors>   
<!-- config the store and forward model for broker network --> 
    <networkConnectors>
      <networkConnector uri="multicast://myBrokerNetwork"
                        name="bridge"
                        dynamicOnly="true"
                        networkTTL="10"
                        conduitSubscriptions="false"
                        decreaseNetworkConsumerPriority="false">
         <dynamicallyIncludedDestinations>
             <queue physicalName="myQueue"/>
         </dynamicallyIncludedDestinations>
      </networkConnector>  
    </networkConnectors>
    <!-- dispatch policy for load balancing -->
    <destinationPolicy>
      <policyMap>
        <policyEntries>
          <policyEntry>
            <destination>
                <queue physicalName="myQueue" />
            </destination>
            <dispatchPolicy>
                <roundRobinDispatchPolicy />
            </dispatchPolicy>
          </policyEntry>
        </policyEntries>
      </policyMap>
    </destinationPolicy>    
  </broker>
</beans>

what happened was:
when I run only Broker1 and Broker3 and Broker4, messages produced from
Broker1 got consumed well by consumers on Broker3 and Broker4.
when I add Broker2 to the above network, messages produced by Broker2 did
not get consumed at all. until I shut down Broker2, the messages queued
started to get consumed.

so my question is: why did this happen, is there a problem in my
configuration or might be a bug for activeMQ?
-- 
View this message in context: http://www.nabble.com/network-of-broker-does-not-work-properly-where-there-are-more-than-1-message-producer-tf3924217s2354.html#a11128530
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: network of broker does not work properly where there are more than 1 message producer

Posted by hh_meta <he...@tvworks.com>.
Some updates on this problem.
Now I switched to use activeMQ 5.0 snapshot, at some point, after I
restarted one of the producer brokers, the system begain to function as
expected.
so it is not a configuration issue, what is it then??


hh_meta wrote:
> 
> I tried to configure a network of broker for distributed queue within
> Spring 2.0. 
> So I have 4 brokers in total:
> Broker1 and Broker2,  both have a message producer on them;
> Broker3 and Broker4,  both have a message consumer on them.
> The idea is message produced from either Broker1 and Broker2 will be
> passed to consumers on Broker3 or Broker4, load-balanced and supports
> failover.
> here is the activemq.xml for all these brokers, each broker uses a
> different tcp port # since I run all 4 brokers on one machine, and I'm
> using ActiveMQ 4.1.1 release:
> <beans>
>   <bean
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
>   <broker name="embedded_broker" useJmx="false" 
> xmlns="http://activemq.org/config/1.0" persistent="false" 
> destroy-method="stop">
>  
> <!-- define a discovery uri for dynamic broker lookup --> 
> <!-- prefetch is set to 1 to make sure load balancing during 1:1 testing,
> we should change that in production env for better performance -->
>     <transportConnectors>
>       <transportConnector
> uri="tcp://localhost:16163?jms.prefetchPolicy.queuePrefetch=1"
> discoveryUri="multicast://myBrokerNetwork"/>
>     </transportConnectors>   
> <!-- config the store and forward model for broker network --> 
>     <networkConnectors>
>       <networkConnector uri="multicast://myBrokerNetwork"
>                         name="bridge"
>                         dynamicOnly="true"
>                         networkTTL="10"
>                         conduitSubscriptions="false"
>                         decreaseNetworkConsumerPriority="false">
>          <dynamicallyIncludedDestinations>
>              <queue physicalName="myQueue"/>
>          </dynamicallyIncludedDestinations>
>       </networkConnector>  
>     </networkConnectors>
>     <!-- dispatch policy for load balancing -->
>     <destinationPolicy>
>       <policyMap>
>         <policyEntries>
>           <policyEntry>
>             <destination>
>                 <queue physicalName="myQueue" />
>             </destination>
>             <dispatchPolicy>
>                 <roundRobinDispatchPolicy />
>             </dispatchPolicy>
>           </policyEntry>
>         </policyEntries>
>       </policyMap>
>     </destinationPolicy>    
>   </broker>
> </beans>
> 
> what happened was:
> when I run only Broker1 and Broker3 and Broker4, messages produced from
> Broker1 got consumed well by consumers on Broker3 and Broker4.
> when I add Broker2 to the above network, messages produced by Broker2 did
> not get consumed at all. until I shut down Broker2, the messages queued
> started to get consumed.
> 
> so my question is: why did this happen, is there a problem in my
> configuration or might be a bug for activeMQ?
> 

-- 
View this message in context: http://www.nabble.com/network-of-broker-does-not-work-properly-where-there-are-more-than-1-message-producer-tf3924217s2354.html#a11145066
Sent from the ActiveMQ - User mailing list archive at Nabble.com.