I have heard different stories from different sources on how the network of brokers works. Assuming no durable consumers and using topics.
1) all brokers either drop an event if there are no active subscriptions else they broadcast the event to all brokers. Once the event is received by all brokers, those brokers either drop the event if no local subscriptions or deliver to the client. I doesnt seem like this is the protocol used as especially for the case of queues, surely each event broadcast would need to have a destination associated with it to ensure two clients do not consume the same event. If we therefore address each event to a specific broker/subscription, what would be the benefit of broadcasting? 2) all brokers know about subscriptions on other brokers. So if an event is published at broker A, and there are active subscriptions on B but not C, the event will only be routed to B. It is also said that selectors are not taken into account until the event is received by the broker with local subscriptions. So the message will be forwarded to B because it has a subscription to a topic on A but once B receives the event it will determine whether or not it is required by the client application. The second description seems more likely as it avoids flooding the network with broadcast packets but could someone please confirm how exactly it works. (1) is quite simple to understand as the remote brokers simply need to know if an active subscription exists on any other broker (doesn't matter which). However if (2) or a similar protocol is used could you please supply some detail into the data structures used to store the destinations (each topic must have a set of destinations to forward a message to) and also the routing protocol used to forward a packet through the network. As a separate question, am I right in assuming each broker uses advisory messages to update other brokers of that brokers active subscriptions etc. The documentation says the network will not work is advisorySupport is turned off so I assume this must allow the brokers to advertise subscriptions. I assume these messages are broadcast whenever a change is made. With respect to (1) above, if this is the protocol followed then each broker must also store a count of the number of active subscriptions so that if a subscription is cancelled on one remote broker then the local broker knows whether to drop any published messages or broadcast. Thanks for any advice. rajdavies wrote: > > > Some background - which may help. > Information about subscriptions are passed dynamically using advisory > messages. Information about the current, active subscriptions are > forwarded - to the remote broker - as are arrivals of new > subscriptions and departures of old. By default information about > Queues and durable subscribers (even if not active) are also > forwarded. More info here: > http://activemq.apache.org/networks-of-brokers.html > Bit confused by filters - there are network filters - which filter out > destinations on a network - but I think you mean selectors ? Selectors > are part of the JMS spec and can be optionally applied to a > MessageConsumer > Rest in-lined: > On 4 Jan 2010, at 20:42, user9876 wrote: > >> >> Hi could someone please explain at a relatively low level how the >> Network of >> Brokers works. I currently have quite a simple understanding that >> once a >> network is set up, a client can publish to any broker in the network >> and >> that message will be forwarded to any subscriptions present on any >> other >> broker. I also believe these subscriptions can have filters. >> I know this is quite a broad question so the particular questions I >> have >> are: >> >> When a client subscribes to a topic on one broker, how are the other >> brokers >> in the network made aware of this new subscription and how do they >> store the >> subscriptions and the individual filters (predicates)? > Subscriptions are dynamic - so information is cached in memory. > However on re-start of a broker - it will query its message store for > queues and durable subscribers - creating a proxy active subscriber > for each. > Filters are defined in the local configuration of the broker. > Selectors on subscriptions are generally ignored. >> >> Does each broker in the network hold replicated information of the >> subscriptions present on the network? > Yes it does. >> >> If two subscriptions exist on one broker with different filters, >> will a >> message be sent once only across the network? And generally how are >> the >> messages routed? > The message will be sent once - and the selector applied locally >> >> >> >> -- >> View this message in context: >> http://old.nabble.com/network-of-brokers-internals-tp27019011p27019011.html >> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com. >> > > cheers, > > Rob > > Rob Davies > http://twitter.com/rajdavies > I work here: http://fusesource.com > My Blog: http://rajdavies.blogspot.com/ > I'm writing this: http://www.manning.com/snyder/ > > > > > > > -- View this message in context: http://old.nabble.com/network-of-brokers-internals-tp27019011p27161929.html Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.