In this tutorial you’ll learn how to set up an Amazon MQ message broker and connect a Java application without rewriting your code.

Amazon MQ is a managed message broker service for Apache ActiveMQ that makes it easy to set up and operate message brokers in the cloud. Message brokers allow different software systems–often using different programming languages, and on different platforms–to communicate and exchange information. ActiveMQ is an open-source project from the Apache Software Foundation. It’s a popular, flexible, and powerful enterprise-grade message broker.

Connecting your current applications to Amazon MQ is easy because it uses industry-standard APIs and protocols for messaging, including JMS, NMS, AMQP, STOMP, MQTT, and WebSocket. Since Amazon MQ uses these standards, you don’t need to rewrite messaging code when you migrate your broker to AWS.

There are several reasons you may benefit from using Amazon MQ.

  • Reduced broker maintenance: Provisioning and managing brokers takes more time as your application scales. A managed message broker like Amazon MQ eliminates this operational overhead.
  • Lower latency: Amazon MQ offers message latency as low as single digit millisecond. This low latency is a result of connection oriented protocols, which lower latency through always-on connections between the broker and the application.
  • Higher availability and durability: Amazon MQ always stores messages redundantly across multiple Availability Zones (AZs). Active-standby brokers automatically fail over to the standby instance, so you can continue sending and receiving messages in the event of the failure of the active broker.
  • Accelerated cloud migration: Using industry standard APIs and protocols, Amazon MQ makes it easy to migrate your existing applications to the cloud because you don’t have to worry about moving and your messaging services. 

In this tutorial you’ll create an Amazon MQ message broker, and use Java Message Service (JMS) to create a connection from a Java application to the broker. We’ll use Java because it has the broadest use in commercial brokers, but in practice you could use another language. After creating the broker, you’ll create a queue, and then send a message.

AWS Experience: Beginner

Time to complete: 25 min, including 15 min for Amazon MQ to spin up a broker

Cost to complete: The service used in this architecture is eligible for the AWS Free Tier, when using a t2.micro broker. If you are outside the usage limits of the Free Tier, or want to trial a higher performance m5.large broker, completing this project will cost you less than $0.60*
Technologies used:
  • An Active AWS Account**
  • Amazon MQ
  • Apache ActiveMQ

*This estimate assumes you follow the recommended configurations throughout the tutorial and terminate all resources within 24 hours.

**Accounts that have been created within the last 24 hours might not yet have access to the resources required for this learning path.