On Mon, Mar 9, 2009 at 9:40 AM, mffrench <mffre...@axway.com> wrote: > > Hello, > > I would like to know if it's possible to configure ActiveMQ to route > messages from a broker A to a broker C through a broker B. In fact I aim to > achieve this kind of topology : > > client X (network 1) send Message to Broker C via Broker A -> broker A > (network 1) send message to broker C via broker B -> broker B (network 1 and > network 2) send message to broker C-> broker C (network 2) <- client Y > (network 2) receive the message from client X > > The broker B in fact is a kind of hub broker which links network 1 and > network 2. Client X is connected only on Broker A and can not send message > to network 2 without connecting to broker B. After reading the broker > network documentation I do not find the way to achieve this kind of > topology. Any idea ?
I believe the topology you're describing is what I've outlined below: ClientX --> BrokerA <--> BrokerB <-->BrokerC <-- ClientY This is easily achievable via a network of brokers in ActiveMQ and something I demonstrate on a single machine quite often. (If you're running on a single machine, you just need to make sure to change all the necessary ports in the three brokers.) To achieve such a broker network, you need to define network connectors between the brokers: http://activemq.apache.org/networks-of-brokers.html Network connectors can be uni-directional or bi-directional based on the value of the duplex attribute on the connector. Setting duplex to true simplifies the network definition a bit because only one network connector needs to be defined between two brokers (one with duplex=true) instead of two (one in each direction, i.e., brokerA --> brokerB and brokerB --> brokerA). Bear in mind that messages will not be broadcast around the network. You may already know this but I've found it's worth mentioning. Messages sent to BrokerA will stay there until there is demand for them on another broker in the network. Which leads to the correct configuration of the network connector to allow messages to make hops between brokers. To allow messages to hop between brokers you need to be aware of is the networkTTL attribute on the network connector. This is what allows messages to make hops between brokers. By default, the networkTTL is set to 1. This means that messages can make one hop between brokers. With this default networkTTL value in your topology, messages sent to BrokerA would wind up on BrokerB and stay there. To allow them to flow from BrokerA to BrokerB to BrokerC, you will need to set the networkTTL to 2. This will allow messages to hop from BrokerA to BrokerB to BrokerC. Hopefully that helps. Bruce -- perl -e 'print unpack("u30","D0G)u8...@4vyy9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*" );' Apache ActiveMQ - http://activemq.apache.org/ Apache Camel - http://camel.apache.org/ Apache ServiceMix - http://servicemix.apache.org/ Blog: http://bruceblog.org/