# Apache ActiveMQ — Reliable Open-Source Java Message Broker > Apache ActiveMQ is a popular open-source message broker written in Java that supports JMS, AMQP, STOMP, MQTT, and OpenWire protocols for reliable asynchronous messaging between applications. ## Install Save in your project root: # Apache ActiveMQ — Reliable Open-Source Java Message Broker ## Quick Use ```bash # Download and run ActiveMQ Classic wget https://archive.apache.org/dist/activemq/6.1.4/apache-activemq-6.1.4-bin.tar.gz tar xzf apache-activemq-6.1.4-bin.tar.gz cd apache-activemq-6.1.4 ./bin/activemq start # Web console at http://localhost:8161 (admin/admin) ``` ```java ConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616"); try (Connection conn = cf.createConnection(); Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE)) { conn.start(); MessageProducer producer = session.createProducer(session.createQueue("orders")); producer.send(session.createTextMessage("order-123")); } ``` ## Introduction Apache ActiveMQ is one of the most widely deployed open-source message brokers. It decouples producers and consumers in distributed systems by providing reliable queues and topics. ActiveMQ implements the JMS specification and supports multiple wire protocols, making it accessible from Java, Python, Node.js, .NET, and other platforms. ## What ActiveMQ Does - Routes messages between applications using queues (point-to-point) and topics (publish-subscribe) - Supports JMS 2.0, AMQP 1.0, STOMP, MQTT, and its native OpenWire protocol - Provides persistent message storage with KahaDB for guaranteed delivery - Offers a web-based admin console for monitoring queues, topics, and connections - Supports broker networks for clustering and geographic distribution ## Architecture Overview ActiveMQ Classic runs as a standalone Java process that accepts connections over multiple transports (TCP, SSL, WebSocket, VM). Messages arrive at destinations (queues or topics) and are stored in a persistence adapter — KahaDB by default — until consumed. Consumers connect, subscribe, and receive messages with configurable acknowledgment modes. A network of brokers can be configured where each broker forwards messages to peers, enabling horizontal scaling and fault tolerance. The advisory message system exposes internal events for monitoring. ## Self-Hosting & Configuration - Download the ActiveMQ Classic distribution and run `./bin/activemq start` - Configure broker settings in `conf/activemq.xml` including transport connectors and persistence - Access the web console at port 8161 for queue monitoring and management - For Spring Boot, add `spring-boot-starter-activemq` for auto-configured JMS templates - Deploy in Docker using the official `apache/activemq-classic` container image ## Key Features - Multi-protocol support connects Java JMS clients alongside MQTT IoT devices and AMQP services - Persistent and non-persistent delivery modes with configurable storage backends - Message groups, virtual destinations, and composite destinations for advanced routing - Built-in scheduler for delayed and periodic message delivery - Network of brokers enables clustering without a shared database ## Comparison with Similar Tools - **RabbitMQ** — Erlang-based broker with strong AMQP support; ActiveMQ is Java-native with broader JMS support - **Apache Kafka** — Distributed log for streaming; ActiveMQ is a traditional message broker with queues and topics - **Apache Artemis** — Next-generation ActiveMQ with a new core; Classic is mature and widely deployed - **Redis Pub/Sub** — In-memory messaging without persistence guarantees; ActiveMQ provides durable message storage - **Amazon SQS** — Managed cloud queue; ActiveMQ is self-hosted with no vendor lock-in ## FAQ **Q: What is the difference between ActiveMQ Classic and ActiveMQ Artemis?** A: Classic is the long-standing broker with a large install base. Artemis is the next-generation broker with a redesigned core for higher throughput. Both are maintained under the Apache ActiveMQ project. **Q: Can ActiveMQ handle high message throughput?** A: Classic handles thousands of messages per second. For higher throughput, consider Artemis or a network of brokers. **Q: Does ActiveMQ support message ordering?** A: Yes. Messages within a single queue are delivered in order to a single consumer. Message groups extend ordering across multiple consumers. **Q: Can I use ActiveMQ with Spring Boot?** A: Yes. The `spring-boot-starter-activemq` dependency auto-configures a JmsTemplate and connection factory. ## Sources - https://github.com/apache/activemq - https://activemq.apache.org/components/classic/ --- Source: https://tokrepo.com/en/workflows/asset-8e6ccc62 Author: AI Open Source