Prev Next

Integration / ActiveMQ Interview Questions Advanced

How does a network of brokers work in ActiveMQ?

A network of brokers connects multiple independent ActiveMQ instances via network connectors, letting messages hop from a broker close to the producer to a broker close to the consumer, without either client knowing about the other broker.

Each broker advertises its local consumers to its network-connected peers; when a producer sends a message to a broker that has no local consumer for that destination but knows a peer broker does, it forwards the message across the network connector to that peer, which then delivers it locally. This forms a store-and-forward mesh rather than a single shared queue: each broker retains its own persistence store, and messages travel only when there's demonstrated demand on the other side, avoiding needless duplication across brokers with no interested consumers.

Networks can be configured as one-way or duplex, and support multiple hops, though each hop adds latency and weakens ordering guarantees, since messages may now traverse different paths depending on where consumers happen to be connected. This pattern is common for geographically distributed deployments, such as a broker per data center, where producers and consumers talk to their local broker for low latency while still reaching consumers anywhere else in the network.

A subtlety worth calling out: network connectors forward based on demand signals, not blind broadcasting, but that demand information itself takes a moment to propagate between brokers when a new consumer first connects, so there can be a brief window right after a consumer subscribes where messages sent before the demand was known don't get forwarded retroactively. This is one reason network-of-brokers topologies are typically designed with stable, long-running consumer groups in mind rather than consumers that connect and disconnect frequently.

What triggers a broker to forward a message across a network connector?
What does adding more hops to a broker network typically increase?

More Related questions...

Show more question and Answers...


Comments & Discussions