Apache ActiveMQ

Master enterprise messaging with the robust, open-source message broker

35 min readIntermediate
Not Started
Loading...

What is Apache ActiveMQ?

Apache ActiveMQ is a powerful open-source message broker that implements the Java Message Service (JMS) API and provides enterprise-grade messaging capabilities. It enables applications to communicate through reliable, asynchronous message passing, supporting various messaging patterns including point-to-point queues and publish-subscribe topics. ActiveMQ is designed for high availability, scalability, and performance in enterprise environments.

Originally developed by LogicBlaze and now part of the Apache Software Foundation, ActiveMQ comes in two main versions: ActiveMQ Classic (the original broker) and ActiveMQ Artemis (next-generation high-performance broker). It supports multiple protocols including JMS, STOMP, MQTT, and AMQP, making it suitable for diverse integration scenarios from traditional enterprise applications to modern microservices and IoT systems.

ActiveMQ Performance Calculator

760
Effective TPS
514MB
Memory Usage
8%
Utilization
74
Reliability

Messages/Consumer: 200

Storage: 3938MB/hr

Bandwidth: 32 Kbps

ActiveMQ Core Features

JMS Implementation

Full Java Message Service API support with enterprise features.

• JMS 1.1 and 2.0 compliance
• Point-to-point queues
• Publish-subscribe topics
• Message selectors
• Durable subscriptions
• Transaction support

Multiple Protocols

Support for various messaging protocols and clients.

• OpenWire (native protocol)
• STOMP (text-based)
• MQTT (IoT messaging)
• AMQP (enterprise standard)
• HTTP/WebSocket
• TCP and UDP transport

High Availability

Enterprise-grade reliability and failover capabilities.

• Master-slave clustering
• Shared storage failover
• Network of brokers
• Message persistence
• Dead letter queues
• Redelivery policies

Management & Monitoring

Comprehensive tools for administration and monitoring.

• Web console administration
• JMX management
• Advisory messages
• Statistics plugins
• REST API management
• Log aggregation

ActiveMQ Messaging Patterns

Point-to-Point (Queues)

One-to-one messaging where each message is consumed by exactly one consumer.

Point-to-Point Pattern
Producer → [Queue] → Consumer
                  ↓
Properties:
• Message consumed once
• Load balancing across consumers
• Message ordering (FIFO)
• Competitive consumption

Publish-Subscribe (Topics)

One-to-many messaging where messages are delivered to all subscribers.

Publish-Subscribe Pattern
Producer → [Topic] → Subscriber 1
                  → Subscriber 2
                  → Subscriber 3
Properties:
• Broadcast to all subscribers
• Durable subscriptions available
• Message selectors supported

Topic hierarchies

Request-Reply Pattern

• Synchronous communication
• Correlation IDs
• Temporary reply queues
• Timeout handling
• RPC-style messaging

Message Routing

• Content-based routing
• Virtual destinations
• Composite destinations
• Message bridges
• Dynamic destinations

ActiveMQ Configuration Examples

Basic Broker Configuration

Essential ActiveMQ broker configuration with persistence and transport connectors.

ActiveMQ Broker Configuration
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost">
  <persistenceAdapter>
    <kahaDB directory="${activemq.data}/kahadb"/>
  </persistenceAdapter>

  <transportConnectors>
    <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
    <transportConnector name="stomp" uri="stomp://0.0.0.0:61613"/>
  </transportConnectors>
</broker>

Java Producer Example

Simple Java code to send messages to an ActiveMQ queue.

ConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61616");
Connection connection = factory.createConnection();
connection.start();

Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Queue queue = session.createQueue("test.queue");
MessageProducer producer = session.createProducer(queue);

TextMessage message = session.createTextMessage("Hello ActiveMQ!");
producer.send(message);

connection.close();

ActiveMQ Use Cases

Enterprise Integration

Connect disparate enterprise systems with reliable messaging.

  • • ERP system integration
  • • Legacy system modernization
  • • B2B communication
  • • Service-oriented architecture

Microservices Communication

Enable loose coupling between microservices through messaging.

  • • Event-driven architecture
  • • Service decoupling
  • • Asynchronous processing
  • • CQRS pattern implementation

IoT and Real-time Systems

Handle high-volume IoT data and real-time event processing.

  • • Sensor data collection
  • • Real-time analytics
  • • Device command distribution
  • • Telemetry processing

Workflow Processing

Coordinate complex business processes and workflows.

  • • Order processing systems
  • • Document workflows
  • • Task queuing
  • • Process orchestration

Real-World ActiveMQ Implementations

NASA

Uses ActiveMQ for mission-critical space exploration data processing and communication.

  • • Spacecraft telemetry processing
  • • Ground station coordination
  • • Scientific data distribution
  • • Mission control integration

Credit Suisse

Leverages ActiveMQ for high-frequency trading and financial transaction processing.

  • • Trading system integration
  • • Risk management messaging
  • • Settlement processing
  • • Regulatory reporting

Red Hat

Integrates ActiveMQ into JBoss middleware for enterprise messaging solutions.

  • • Application server integration
  • • Enterprise service bus
  • • Cloud messaging platform
  • • Container orchestration

European Central Bank

Uses ActiveMQ for critical financial infrastructure and payment processing systems.

  • • Payment system messaging
  • • Bank-to-bank communication
  • • Regulatory data exchange
  • • Audit trail messaging

ActiveMQ Best Practices

✅ Do

  • • Configure appropriate persistence for your use case
  • • Implement dead letter queue handling
  • • Monitor broker performance and queue depths
  • • Use message selectors for efficient filtering
  • • Configure clustering for high availability
  • • Set appropriate TTL for messages
  • • Implement proper connection pooling

❌ Don't

  • • Send large messages without consideration
  • • Ignore message acknowledgment patterns
  • • Use synchronous sends for high throughput
  • • Forget to handle connection failures
  • • Skip security configuration in production
  • • Allow unbounded queue growth
  • • Neglect regular maintenance and monitoring

📝 Apache ActiveMQ Quiz

1 of 6Current: 0/6

What is Apache ActiveMQ?