Connect To Amazon MQ Message Broker In MuleSoft

Author: Saddam Shaikh

In this article, I will walk you through the process of setting up a message broker in Amazon MQ and build an application that connects Amazon MQ to receive queue messages.

What is Amazon MQ?

Amazon MQ is a managed message broker service for Apache ActiveMQ and RabbitMQ that streamlines the setup, operation, and management of message brokers on AWS. It is recommended for migrating applications from existing message brokers that rely on compatibility with APIs such as JMS or protocols such as AMQP, MQTT, OpenWire, and STOMP.

Amazon MQ Configuration Steps:

  1. Search Amazon MQ in AWS Console. Click on Get Started.

2. Select Apache ActiveMQ as the broker engine type and click on Next.

3. Select Deployment mode as Active/standby broker and Storage type as Durability optimized. Click on Next.

4. Enter the Broker name, Username, and Password. Keep Additional settings as the default one. Click on Next.

5. Review the details and click on Create Broker. It will take around 25 minutes to deploy the Amazon MQ message broker.

6. Once the Amazon MQ message broker status is showing Running, try to access the ActiveMQ Web Console URL. Only one of the ActiveMQ consoles is active at a time. If you are not able to access it then add your source IP in Inbound Rule to allow traffic.

Amazon MQ Console Details
Security Groups Snapshot

7. Once the source IP is allowed to access ActiveMQ URL then you will see the ActiveMQ web console page.

ActiveMQ Home Page

Click on Manage ActiveMQ broker, pop up will appear to enter username & password, once successfully authenticated below page will be shown.

8. Click on Queues. Enter the Queue Name as “MuleSoft-1” and click on Create.

Click on Send To to open a window allowing us to send messages to the queue. Add the message body and click on Send.

9. Verify message is delivered to the queue.

MuleSoft Configuration Steps:
  1. Navigate to Add Modules and Drag and Drop the JMS connector to the Mule Palette section.
  2. Configure JMS config. Broker URL: OpenWire failover endpoint.
JMS Config

3. Configure the On New Message operation to receive messages from the queue.

On New Message Operation Config

4. Deploy the application and test.

MuleSoft Flow

Hope you find this article helpful.


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.