Introduction
Imagine you want to know the latest weather update as soon as you turn on your device, but you missed the broadcast earlier. Retained messages solve this problem by keeping the last important message ready for anyone who connects later.
Imagine a bulletin board in a community center that always shows the latest weather forecast. Anyone entering the center can see the current forecast immediately without asking around or waiting for someone to announce it.
┌───────────────┐ publishes with retain ┌───────────────┐
│ Publisher │───────────────────────────────▶│ Broker │
└───────────────┘ └───────────────┘
│
│ stores last message
▼
┌─────────────────┐
│ Retained Message │
└─────────────────┘
│
│ delivers to new
│ subscribers
▼
┌───────────────┐
│ Subscriber │
└───────────────┘