ActiveMQ
Popular open-source message broker.
Overview
Apache ActiveMQ is a mature, Java-based open-source message broker that has been a cornerstone of enterprise messaging since 2004. It implements the Java Message Service (JMS) specification and provides reliable message queuing, pub/sub messaging, and advanced routing capabilities for distributed applications. ActiveMQ supports multiple protocols including OpenWire, STOMP, AMQP, and MQTT, making it versatile for heterogeneous environments where different applications need to communicate asynchronously.
This Docker deployment provides a complete ActiveMQ Classic instance with persistent message storage and access to both the messaging engine and web-based management console. The setup exposes the primary OpenWire protocol on port 61616 for JMS clients, while the web console on port 8161 allows administrators to monitor queues, topics, connections, and message flow in real-time. The persistent volume ensures message durability across container restarts, critical for production messaging scenarios.
Development teams building microservices architectures, system integrators connecting legacy applications, and enterprises implementing event-driven architectures will find this deployment particularly valuable. ActiveMQ excels in scenarios requiring guaranteed message delivery, complex routing patterns, and integration with Java-based applications, while also supporting lightweight protocols for IoT devices and web applications through STOMP and MQTT.
Key Features
- JMS 1.1 compliant message broker supporting both point-to-point queues and publish-subscribe topics
- Multi-protocol support including OpenWire, STOMP, AMQP 1.0, and MQTT for diverse client connectivity
- Web-based administration console with real-time monitoring of queues, topics, connections, and message statistics
- Message persistence with configurable storage adapters ensuring durability across restarts
- Virtual destinations enabling complex routing patterns and message transformation
- Message groups for ordered processing and exclusive consumers for load balancing
- Network of brokers capability for clustering and high availability deployments
- Dead letter queue handling for failed message processing and poison message management
Common Use Cases
- 1Microservices communication requiring reliable asynchronous messaging between distributed components
- 2Enterprise application integration connecting legacy systems with modern applications
- 3Event-driven architectures implementing CQRS patterns and event sourcing
- 4IoT device communication using MQTT protocol for sensor data collection and device control
- 5Batch processing systems requiring job queue management and work distribution
- 6Real-time notification systems for web applications using STOMP over WebSockets
- 7Financial services implementing trade processing and settlement workflows with guaranteed delivery
Prerequisites
- Docker Engine 20.10+ and Docker Compose V2 for container orchestration
- Minimum 512MB RAM allocated to Docker for basic ActiveMQ operations
- Available ports 8161 and 61616 on the host system for web console and JMS connectivity
- Basic understanding of message queuing concepts including queues, topics, and JMS
- Java development knowledge if building custom JMS clients or message processors
- Network access planning for client applications connecting to the message broker
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 activemq: 3 image: apache/activemq-classic:latest4 container_name: activemq5 restart: unless-stopped6 volumes: 7 - activemq_data:/opt/activemq/data8 ports: 9 - "61616:61616"10 - "8161:8161"1112volumes: 13 activemq_data: .env Template
.env
1# Default credentials: admin / adminUsage Notes
- 1Docs: https://activemq.apache.org/components/classic/documentation
- 2Web console at http://localhost:8161/admin, default: admin/admin
- 3JMS/OpenWire on port 61616, AMQP on 5672, STOMP on 61613
- 4Supports queues (point-to-point) and topics (pub/sub)
- 5Create destinations via web console or on first use
- 6Enterprise features: message groups, virtual destinations, network of brokers
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 activemq:5 image: apache/activemq-classic:latest6 container_name: activemq7 restart: unless-stopped8 volumes:9 - activemq_data:/opt/activemq/data10 ports:11 - "61616:61616"12 - "8161:8161"1314volumes:15 activemq_data:16EOF1718# 2. Create the .env file19cat > .env << 'EOF'20# Default credentials: admin / admin21EOF2223# 3. Start the services24docker compose up -d2526# 4. View logs27docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/activemq/run | bashTroubleshooting
- OutOfMemoryError in ActiveMQ logs: Increase Docker container memory limits and configure ActiveMQ heap size via ACTIVEMQ_OPTS environment variable
- Web console shows 'admin/admin login failed': Check if default credentials were changed or container logs for authentication errors
- JMS clients cannot connect on port 61616: Verify firewall settings and ensure the OpenWire transport connector is enabled in ActiveMQ configuration
- Messages not persisting after container restart: Confirm the activemq_data volume is properly mounted and has write permissions
- High CPU usage with message buildup: Check for slow consumers and configure message cursors or implement dead letter queue policies
- STOMP/MQTT connections failing: Ensure additional transport connectors are configured for these protocols beyond the default OpenWire
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Ad Space
Shortcuts: C CopyF FavoriteD Download