What is activemq
June 4, 2020

What is Apache ActiveMQ?

Development

ActiveMQ is a popular messaging service. Here, we break down what ApacheMQ is, what Apache ActiveMQ brokers do, and how to get the most out of ActiveMQ.

What Is ActiveMQ?

ActiveMQ is a popular open source Java messaging service.

What are Apache ActiveMQ Brokers? 

Apache ActiveMQ brokers are implementations of the Java Messaging Service, or JMS. JMS is a Java specification which allows applications to send data back and forth between one another in an easy and standard way.

Before the advent of messaging systems, it was often difficult if not impossible to “federate” applications which were written in disparate languages, resided on heterogeneous platforms, or used different data structures and protocols.

apache activemq

An early goal of Java was to present a language with the power of C which was not hindered by its cross-platform issues. It follows then, that JMS arose out of a growing need to federate very different systems with each other. 

At the time, if a developer wanted to write an application and allow that application to run easily across multiple operating systems, that meant building the source code against native tooling and libraries. Alternatively, outright porting or re-writing the application on separate operating systems.  

Why Use Enterprise Messaging Solutions?

Enterprises feel this disparity with business actions such as mergers and acquisitions creating the need to maintain an increasingly heterogeneous collection of business applications.  As the enterprise grows, so does the need to allow all of these platforms to share data.  A number of architectural patterns exist today which help to solve this problem, including the patterns of enterprise messaging.  JMS is one example, then, of an enterprise messaging solution.

What JMS Used For?

The intent of JMS was to build vendor-neutral API for sending enterprise messages through Java. It should be noted that JMS is just a specification and API, it’s not a piece of software on its own. In fact, as demonstrated in the link to the specification above, it’s just a piece of paper that describes, exactly, how to build an enterprise-class messaging system using Java.

JMS Message Structure

JMS’s anatomy consists of data patterns called Messages, Queues, and Topics. Messages are just what they sound like, payloads of data that can be shipped between various systems.  These payloads can have headers and properties associated with them which can categorize them, control various portions of their routing, and otherwise facilitate moving the payloads around a connected network of applications. See below for a basic JMS Message Structure:

how activemq works

The payload itself can be any Java object in a pure-Java implementation but is typically some form of text message. Note that the text could be a markup format such as XML or JSON as well. The purpose of a messaging system is to move these payloads between heterogeneous systems in a standard way. 

What Classifies an Enterprise-Class Messaging Solution? 

The distinction of an enterprise-class messaging solution is one that can do this while also maintaining data integrity, guaranteeing no data loss, considering high availability, security, recoverability, and other common enterprise concerns.

The applications themselves within our network are thought of as endpoints, and there are two categories of them. Inbound endpoints which are used to read or receive messages are called Consumers, and outbound ones meant to send data into the messaging system are called Producers. This is handled programmatically; the endpoint is defined in the context of the program that is interacting with the messaging system. 

How Messages Work

Once messages make their way into the system, they are arranged into two patterns: queues and topics. Queues are FIFO (first-in, first out) pipelines of messages produced and consumed by brokers and clients. Producers create messages and push them onto these queues, and then those messages are polled and collected by Consumer applications, one message at a time.
 
Topics are subscription-based message broadcast channels. When a Producing application, sometimes called a ‘Publisher’ in the context of Topic messaging, sends a message, multiple recipients who are ‘Subscribed’ to that topic all receive a broadcast of the message.  

All of these components are just parts of the JMS specification, but aren’t any one piece of software in particular. To realize the specification in real life, we can create a vendor-specific implementation of the JMS spec, known as a JMS Provider. 

ActiveMQ is a JMS Provider

ActiveMQ, then, is a JMS Provider. A JMS Provider forms the software framework for facilitating the use of JMS concepts inside an application. A single node of ActiveMQ which allows clients to connect to it and use these messaging concepts is called an “ActiveMQ Broker.” Some other examples of JMS providers are: 

  • HornetQ
  • RabbitMQ
  • SonicMQ
  • Windows Azure Messaging
Apachemq broker

Apache ActiveMQ 5 vs. Apache ActiveMQ 6

Apache ActiveMQ 5 implements the JMS 1.1 spec, and ActiveMQ 6 (Artemis) will implement JMS 2.0). In addition to the JMS concepts described above, ActiveMQ also providers Persistence, which allows messages to be “replayed” should a broker crash. Along with that, Durability allows Topic subscribers to receive broadcast messages during periods of time that their connectivity to the broker has been interrupted.

ActiveMQ Functions

Over and above JMS, ActiveMQ provides additional functionality such as:

  • A native ActiveMQ Connection Factory object for Java
  • Powerful observability features with its detailed JMX metrics and statistics engine
  • Support for extended dashboarding through Jolokia and HawtIO
  • JAAS Security 
  • Support for multiple connection protocols
  • Native HA and DR capabilities
  • Built-in functionality for both horizonal and vertical scale

ActiveMQ Is the Ideal Messaging Solution

Apache ActiveMQ is free and open source under the permissive Apache 2.0 ASF license. It is backed by a prolific and responsive developer community and was envisioned by some of the early creators of the now ubiquitous Enterprise Integration Pattern (EIP) architecture.  

Putting together these patterns with JMS makes it easy to understand how ActiveMQ works.  ActiveMQ brokers themselves support a number of connection protocols, allowing them to provide highly normalized connection points between applications coded in different languages, such as Java, C++, .NET, PHP, and others. 

This makes ActiveMQ an ideal free messaging solution for enterprises. Users commonly migrate to ActiveMQ from commercial middleware such as WebSphereMQ, Oracle AQ, TIBCO EMS, and/or MSMQ.

Credibility of ActiveMQ 

ActiveMQ is a mature and well-adopted platform, with thousands of companies using it, and is by far the most flexible OSS message broker available. As if that’s not enough, it also ships with Apache Camel and shares developers and committers with the Apache Camel product. This gives it a tremendous level of sophistication in terms of designing complex messaging patterns.

Scale of ActiveMQ Data

ActiveMQ can be tuned for massive scale, supporting large data sets, such as those generated by the CERN large hadron collider. Its configuration can support numerous traffic and implementation models and has a powerful statistics and metrics engine, exposing crucial details about the health of the broker and the amount and size of message traffic and client status. These metrics can be consumed by popular monitoring frameworks, making ActiveMQ a highly observable solution.

Get More Out of ActiveMQ

Though not the only free messaging solution available, Apache ActiveMQ stands out for balancing its versatility with enterprise-readiness. Businesses can adopt ActiveMQ quickly, and its familiar concepts will be accessible to anyone comfortable with JMS. ActiveMQ’s prolific community will ensure the products continued viability, and ActiveMQ 6 promises to extend this usefulness into the next generation of enterprise messaging solutions.  

Looking to get started with Apache ActiveMQ? Connect with one of our open source architects to get answers to your questions and to learn more about migration, innovation, cost-savings, and much more. Connect with an expert today. 

CONNECT WITH ACTIVEMQ EXPERT

 

Related Content: