MuleSoft Integration With Amazon MQ (ActiveMQ)

Author: Shivam Shakya

In this blog, we will learn about the integration of MuleSoft with Amazon MQ and how to create an Amazon MQ.

What is Amazon MQ?

Amazon MQ is a managed message broker service provided by Amazon Web Services (AWS). It enables you to decouple the components of your applications using a messaging protocol. Amazon MQ is based on the Apache ActiveMQ message broker, which is a popular open-source messaging platform. It supports multiple messaging protocols such as MQTT, AMQP, OpenWire, and STOMP, enabling you to connect various types of clients and applications. With Amazon MQ, you can easily set up and operate message brokers without the need to manage the underlying infrastructure. It takes care of tasks such as hardware provisioning, software installation, maintenance, and scaling, allowing you to focus on developing your applications.

  • Anypoint Platform Account
  • Anypoint Studio 7.6 or later
  • AWS account credentials
Amazon MQ configuration

Follow the below steps to create Amazon MQ:

  1. Search AWS MQ in the AWS search console.
  1. Click on Get Started.
  1. We have 2 broker engines present for Amazon MQ. A broker engine is a type of message broker that runs on Amazon MQ. Please select Apache ActiveMQ.
  1. Choose the deployment mode and storage type for amazon MQ. Single-instance Broker is for Single Availability Zone and Active/standby broker is for high availability and automatic failover.
  1. Configuration setting for Amazon MQ.
  1. Broker Creation will take about 20 minutes. Broker’s configuration can be found on the configuration page.
  1. Once a Broker is created, open that broker and click on the Active MQ web Console URL.
  1. Click on the Manage Active MQ Broker.

NOTE: If the ActiveMQ GUI is not working, open Amazon MQ in AWS. Then, click on “Security Groups” within the Amazon MQ interface. Inside the security group, click on “Edit Inbound Rules” and add the system’s public IP for ports 8162 and 61617.

Port 8162 is used to access the GUI.

Port 61617 is used for MuleSoft Configuration.

  1. We will get a pop-up for Username and password. Use the same credentials which we used while creating the broker in AWS.
  1. Create a Queue or Topic.

We have completed the Lambda configuration in AWS. Let’s check how to call this Amazon MQ in MuleSoft code.

MuleSoft Code Configuration
  1. Create a Mule application with JMS publish and On-New-Message connectors. We will post data in Queue using JMS publish and then consume that data from On-New-Message.
  1. For JMS configuration, we need username and password which we used while creating the broker in AWS and Broker URL which we can get from Amazon MQ Endpoints.OpenWire URL is used for BrokerURL.
  1. Click Test Connection.
MuleSoft Flows
Publish Flow
Consume Flow
Testing Mule API
  1. Use the Postman to test our API.
  1. MuleSoft Publish Flow.
  1. Message published into the Queue Successfully.
  1. MuleSoft Consume Flow.
  1. Message consumed successfully from the queue.

I hope you find this article helpful. Thanks for reading.


We use cookies on this site to enhance your user experience. For a complete overview of how we use cookies, please see our privacy policy.