Overview

Chapter 10. Deploying ActiveMQ in the enterprise

This chapter introduces enterprise deployment concerns for ActiveMQ, focusing on production-ready setups that must remain available around the clock and avoid message loss. It explains how to prepare brokers for disaster scenarios such as hardware, network, software, or power failures, and how client failover helps applications reconnect safely when a broker changes. The chapter also frames ActiveMQ as a reliable messaging backbone for geographically distributed systems and for environments with very high concurrency demands.

A major part of the discussion is high availability through master/slave configurations. In a shared-nothing setup, a slave broker keeps its own storage and replicates state from the master, taking over if the master fails, though this approach can require manual intervention and careful timing to avoid message loss. In a shared-storage setup, brokers share a database or file system so only one is active at a time, but failover is smoother and can be easier to manage. The chapter compares these approaches, highlights when each is appropriate, and emphasizes the trade-offs between simplicity, performance, and operational overhead.

The chapter then explains how ActiveMQ brokers communicate across networks using store-and-forward behavior, where messages are kept locally and relayed to other brokers when needed. It covers broker discovery, including multicast and static configurations, along with important network settings such as destination filtering, duplex connections, consumer priority, and message hop limits. Finally, it outlines scaling strategies for large deployments: vertical tuning for thousands of connections and queues, horizontal scaling by linking multiple brokers, and traffic partitioning, where the application itself decides which broker handles which traffic to maximize throughput and control complexity.

A shared nothing master/slave
Using a shared relational database for ActiveMQ master/slave high availability
Using a shared file system for ActiveMQ master/slave high availability
Passing messages between ActiveMQ brokers using store and forward
Supermarket communicates to its back office using an ActiveMQ bidirectional network
Combining high availability and networks for an enterprise deployment of ActiveMQ
Using more than one network connection for message passing between ActiveMQ brokers
Using traffic partitioning with ActiveMQ master/slave deployment

FAQ

What is the main goal of deploying ActiveMQ in an enterprise environment?Provide production-grade messaging with high availability, no message loss, and 24/7 service reliability. The chapter focuses on surviving machine, broker, network, and power failures while keeping applications available.
What are the two main high-availability master/slave options in ActiveMQ?ActiveMQ supports shared nothing and shared storage master/slave configurations. Shared nothing uses separate message storage per broker, while shared storage uses a common database or file system with only one active broker at a time.
How does shared nothing master/slave work?In shared nothing, the slave connects to the master and replicates messages, acknowledgements, subscriptions, and transactions before the master processes them. If the master fails, the slave can either shut down or take over and start its transports and network connections.
When should you use shared nothing master/slave?Use it when some downtime is acceptable after a failure and an administrator can manually configure a new slave if needed. It is suitable when you want message safety but can tolerate operational intervention during failover recovery.
What does the waitForSlave property do on a master broker?waitForSlave prevents the master from accepting client or network connections until a slave has attached. This helps avoid message loss that could happen if the master processes messages before replication is in place.
What is the advantage of shared storage master/slave?Shared storage allows multiple brokers to use the same database or file system, with one broker active at a time. It usually requires no manual intervention when a master fails, and it supports any number of slave brokers.
What is store and forward in an ActiveMQ network of brokers?Store and forward means messages are stored locally first, then forwarded to another broker across the network. If the connection fails, undelivered messages remain stored and are forwarded once connectivity returns.
What is the difference between static and multicast network discovery?Static discovery uses a configured list of broker URIs and is common in deployments that need explicit control. Multicast discovery automatically finds brokers using IP multicast, but it is typically limited to the local network segment and offers less control.
How can ActiveMQ be tuned for vertical scaling to support many connections and queues?Use NIO transport, reduce thread usage with UseDedicatedTaskRunner=false, set enough JVM and broker memory, disable tight encoding on clients, and enable optimizedDispatch for queues. KahaDB or JDBC storage also helps scale to large numbers of destinations.
What is traffic partitioning in ActiveMQ?Traffic partitioning is a hybrid approach where the client decides which destinations go to which broker, often using multiple JMS connections. It reduces forwarding overhead and can improve scalability, but it adds application complexity.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • ActiveMQ in Action ActiveMQ in Action ebook for free
Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • ActiveMQ in Action ActiveMQ in Action ebook for free