DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modern Digital Website Security: Prepare to face any form of malicious web activity and enable your sites to optimally serve your customers.

Containers Trend Report: Explore the current state of containers, containerization strategies, and modernizing architecture.

Low-Code Development: Learn the concepts of low code, features + use cases for professional devs, and the low-code implementation process.

E-Commerce Development Essentials: Considering starting or working on an e-commerce business? Learn how to create a backend that scales.

Related

  • MuleSoft Anypoint Platform Audit Logs to Splunk
  • Navigating Challenges in Online Banking API Testing
  • Create Custom DataWeave Functions in Mule 4
  • Migrating MuleSoft System API to AWS Lambda (Part 1)

Trending

  • What’s New Between Java 17 and Java 21?
  • Apply Strangler Pattern To Decompose Legacy System Into Microservices: Part 1
  • Implementing Data Lakes in Data Management
  • Navigating NoSQL: A Pragmatic Approach for Java Developers
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. Using MuleSoft With Amazon MQ

Using MuleSoft With Amazon MQ

This post will walk you through the process of setting up a broker in Amazon MQ and building a Mule application that connects to Amazon MQ using the JMS Connector.

Dejim Juang user avatar by
Dejim Juang
·
Jul. 06, 18 · Tutorial
Like (2)
Save
Tweet
Share
9.8K Views

Join the DZone community and get the full member experience.

Join For Free

Amazon MQ is a managed message broker service for Apache ActiveMQ, and as a result, connectivity with Amazon MQ and MuleSoft has been there since day one. Amazon MQ makes it easy to set up and operate message brokers in the cloud and it gives direct access to the ActiveMQ console and industry standard APIs and protocols for messaging including JMS, NMS, AMQP, STOMP, MQTT, and WebSocket.

This post will walk you through the process of setting up a broker in Amazon MQ and building a Mule application that connects to Amazon MQ using the JMS Connector.

In the AWS Console, locate and open the Amazon MQ service. Under Create a broker, in the top-right, enter a name for your broker and click on Next step.

Image title

Next, select the Broker instance type. For testing purposes, chose the mq.t2.micro instance, which is eligible for the Free Tier.

Image title

Select Single-instance broker for the Deployment mode, and then set the username and password under the ActiveMQ Web Console access section.

Image title

In the Network and security section, set up the Virtual Private Cloud, Subnet, and Security group(s). Set the Public accessibility to Yes, and then leave the Maintenance section with the default values. Click on Create broker. It takes about 15 minutes to spin up a new broker.

Image title

Once the broker is setup, we'll want to log in to the ActiveMQ Web Console and set up a new queue for Mule to publish to and consumer a message from. To be able to access your broker's ActiveMQ Web Console URL or wire-level protocol endpoints, you'll need to configure your security groups to allow inbound traffic on those ports. Specifically, port 8162 and 61617.

Image title

Once you allow inbound traffic to those ports, open the URL to the web console and click on the Manage ActiveMQ broker link. Login with the username and password you configured when setting up the broker. Next, click on Queues and type in a name for a queue and click on Create.

Image title

Now that we have the broker up and running and a queue configured, let's talk about the Mule application that will publish to and consume a message from the queue. You can download an example project from Github here (https://github.com/djuang1/jms-example-mule4). It's a pretty simple example with the first flow publishing a message to the queue and the second flow listening and writing the message to the console.

Image title

The key to this example is just showing you how to configure the JMS connector to connect to Amazon MQ. Click on the Publish component and click on the Edit button next to the Connector configuration field for JMS_Config.

Image title

Within the Global Element Properties window, you can see what needs to be configured. The library for the ActiveMQ client is the only required library you need unless you plan to use the Broker or KahaDB. When you click on Add dependency, it comes pre-populated with the artifact definition which makes setup easy. 

Once that is added, you just need to configure the connection with the username and password for the ActiveMQ broker. You can set up a different user if you prefer to not use the Administrator account.

Lastly, for the Broker url field, just copy and paste the OpenWire URL from the Amazon MQ configuration page. 

After you configure the settings for your own broker, run the project in Studio and then open up a browser to test out the flow. Navigate to http://localhost:8081/test to kick off the publishing of the message, and then you can see the consumption in the Console window once the flow picks the message off the queue.

Image title

As you can see, it's pretty easy to set up and connect to Amazon MQ. The JMS Connector, which is included out of the box, is easy to setup and configure. To find out more about the JMS Connector, you can click here and read up on more configuration options in the MuleSoft documentation. (https://docs.mulesoft.com/connectors/jms-connector)

If you have any questions or issues, leave a comment or feel free to reach out to me.

MuleSoft Console (video game CLI)

Opinions expressed by DZone contributors are their own.

Related

  • MuleSoft Anypoint Platform Audit Logs to Splunk
  • Navigating Challenges in Online Banking API Testing
  • Create Custom DataWeave Functions in Mule 4
  • Migrating MuleSoft System API to AWS Lambda (Part 1)

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: