PlantUML Sequence Diagram: Async Message Queues

Draw asynchronous messaging patterns with PlantUML. Model event-driven architectures, message queues, and pub/sub systems with sequence diagrams.

Sequence Diagrams

Detailed Explanation

Asynchronous Messaging Patterns in PlantUML

Modern systems use message queues and event-driven patterns extensively. PlantUML sequence diagrams can model these asynchronous interactions clearly.

Basic Async Pattern

@startuml
title Event-Driven Order Processing

participant "Order API" as API
queue "Message Queue" as MQ
participant "Payment Service" as Pay
participant "Inventory Service" as Inv
participant "Email Service" as Email

API ->> MQ: Publish OrderCreated event
MQ ->> Pay: Consume OrderCreated
MQ ->> Inv: Consume OrderCreated
Pay ->> MQ: Publish PaymentProcessed
MQ ->> Email: Consume PaymentProcessed
Email ->> Email: Send confirmation
@enduml

Queue Participant Type

Use queue as the participant type for message brokers. This renders a distinct icon that makes the async boundary immediately visible.

One-Way Arrows

Async messages are fire-and-forget. Use open arrowheads (->>) to indicate the sender does not wait for a response.

Parallel Processing

par Payment Processing
  MQ ->> Pay: OrderCreated
  Pay ->> Pay: Charge card
else Inventory Check
  MQ ->> Inv: OrderCreated
  Inv ->> Inv: Reserve stock
end

The par block shows that payment and inventory happen concurrently, which is the key benefit of event-driven architecture.

Dead Letter Queue

alt Processing succeeds
  Pay ->> MQ: PaymentSuccess
else Processing fails (3 retries)
  Pay ->> MQ: Move to DLQ
  note right: Manual investigation required
end

Modeling failure paths is just as important as happy paths. The alt/else block combined with notes documents retry and dead-letter behavior.

Use Case

Designing event-driven microservice architectures, documenting Kafka or RabbitMQ topic flows, explaining CQRS and event sourcing patterns to teams, and planning system integration with third-party message brokers.

Try It — PlantUML Editor

Open full tool