Getting Started With JMS-ActiveMQ: Explained in a Simple Way

Java Message Service (JMS) is a very useful open source that works as a message-oriented middleware.

About JMS

  • The Java Message Service (JMS) API is a messaging standard that allows application components based on the Java Platform Enterprise Edition (Java EE) to create, send, receive, and read messages.
  • It enables distributed communication that is loosely coupled, reliable, and asynchronous.
  • Messaging is a technique to communicate with different software components and/or applications.
  • JMS, a messaging service, is mainly used to send and receive messages from one application to another.
  • There are different JMS brokers/providers like ActiveMQ, RabbitMQ, OpenMQ, etc.
  • I will be using ActiveMQ for this tutorial.

About ActiveMQ

  • ActiveMQ is a messaging service that facilitates disparate data at scale in enterprise systems. 
  • ActiveMQ is a popular open-source messaging service that is built in Java. 
  • It works as a message-oriented middleware or MoM for short.

Setting Up ActiveMQ

  • Java must be installed and set up (JAVA_HOME and PATH variables). I am using Java 8 for this tutorial.
  • Download ActiveMQ (we will use "Classic" for this tutorial)

ActiveMQ classic

Release of ActiveMQ v5.17.0

On the heels of the ActiveMQ v5.16.4 release, the Apache ActiveMQ team has released v5.17.0.

Modernization Updates

The v5.17.0 release will be most notable for what comes next. This release was more about aligning Java JDK and dependencies for moving forward than adding new features.

Setup ActiveMQ Artemis on Windows

Overview

ActiveMQ Artemis is an open-source "next generation" broker from Apache with the performance and feature-set to implement high-performance messaging systems. Artemis is the code-name used for the HornetQ code that was donated to the Apache Foundation.

Pre-requisites:

  • Windows 7 or higher
  • Java 7 or higher

Let us start Artemis setup on Windows machine.

Request-Reply Pattern Using Correlation ID Mule4 Using ActiveMQ

Agenda

  • Introduction.
  • Create a request/reply queue.
  • Create and an exchange and bind it with the request-queue.
  • Develop a Mule 4 flow to comply with the correlation-id.

Introduction

When the requester generates a request message, it assigns a request ID to the request—an identifier that is distinct from these for all other presently outstanding requests, that is, requests that do not yet have replies. When the replier treats the request, it keeps the request ID and adds that ID to the reply as a correlation ID. When the requester processes the reply, it uses the correlation ID to identify which request the reply is for. This is called a Correlation Identifier because of the way the caller uses the identifier to associate (i.e., match, show the relationship) each reply to the request that generated it.

Create a Request/Reply Queue

Request queue is created: address-queue.

Introduction to Message Brokers (Part 2): ActiveMQ vs. Redis Pub/Sub

In our previous overview of the most popular messaging systems, we were talking about Apache Kafka vs. RabbitMQ. Now, let's take a look at the less powerful, but still very helpful, message brokers. We will consider the pros and cons of ActiveMQ and Redis Pub/Sub. Although these solutions aren't very suitable for processing big data, they provide a strong basis for creating small business analytics tools.

Apache ActiveMQ

Pricing: free