Menu
AWS Architecture Blog·November 18, 2025

Building Priority-Based Message Processing with Amazon MQ

This article demonstrates how to design and implement a priority-based message processing system using AWS managed services like Amazon MQ, DynamoDB, and App Runner. It focuses on routing messages based on priority levels, implementing configurable delays, and providing real-time user feedback via WebSockets and DynamoDB Streams. The solution highlights serverless architecture principles and dual-layer retry mechanisms for reliability.

Read original on AWS Architecture Blog

Introduction to Priority-Based Messaging

Organizations often require messaging systems that can differentiate and prioritize critical business operations over routine tasks. This ensures time-sensitive requests, such as high-value customer orders or system alerts, are processed immediately, while standard requests are handled efficiently in the background without blocking urgent flows. This architectural pattern is crucial for maintaining operational efficiency and responsiveness in modern distributed systems.

Architectural Overview

The proposed solution leverages a serverless architecture with several AWS managed services to build a robust priority-based message processing system. Key components include Amazon MQ for message queuing with JMS priority support, Amazon DynamoDB for persistent storage and change data capture (CDC), and AWS App Runner for scalable, containerized compute. The system is designed to provide real-time status updates to users, enhancing transparency and user experience.

  • Amazon MQ (Apache ActiveMQ): Utilized for its native support of JMS priority levels (0-9). High-priority messages are assigned JMS priority 9, standard priority 4, and low priority 0, allowing the broker to automatically order messages.
  • AWS App Runner: Provides a fully managed environment for deploying and scaling containerized applications, handling automatic scaling, load balancing, and HTTPS.
  • Amazon DynamoDB: A NoSQL database providing high-performance, scalable data persistence. DynamoDB Streams are used for capturing changes and facilitating real-time updates.

Message Flow and Priority Handling

The system implements intelligent routing based on three priority levels: High, Standard, and Low. This routing is complemented by conditional delay processing, ensuring that only standard and low-priority messages are subject to configurable application-level delays before entering the main queue.

  • High-priority path: Messages bypass all configured delays and are immediately queued with JMS priority 9, ensuring express processing.
  • Standard-priority path: Messages undergo a specified delay period, implemented using asynchronous processing (e.g., CompletableFuture), before being added to the queue with JMS priority 4.
  • Low-priority path: Messages are processed after all higher-priority messages, with JMS priority 0. These may also be subject to delays or processed when system load permits.
💡

Reliability and Real-time Feedback

The solution incorporates dual-layer retry mechanisms and dead-letter queue (DLQ) configurations with Amazon MQ for maximum message reliability. For real-time user feedback, WebSocket connections are established, integrated with DynamoDB Streams for change data capture, allowing a React frontend to display live status updates as messages progress through the system.

message queuepriority queueawsamazon mqapp runnerdynamodbserverlessreal-time

Comments

Loading comments...
Building Priority-Based Message Processing with Amazon MQ | SysDesAi