Subscriptions
A subscription is a real-time message delivery destination.
Use subscriptions when clients need current messages with low latency. A subscription is not durable: it exists to push live messages to active consumers, not to store messages for later replay.
If a client disconnects, its subscription is removed. Messages published while the client is offline are not retained for that subscription.
How Subscriptions Receive Messages
A subscription receives messages through a binding to one or more topic filters.
When a producer publishes a message to a matching topic, FlowMQ sends the message to active consumers on that subscription.
Fan-Out
Subscriptions use a fan-out model. Each active consumer receives a copy of each matching message.
This differs from a queue, where each message is assigned to one consumer.
Shared Subscriptions
A shared subscription lets multiple consumers share the same subscription group.
For a shared subscription, each matching message is delivered to one active consumer in the group. This allows consumers to scale out real-time processing without sending every message to every consumer.
If no consumer in the shared subscription is active, matching messages are not retained by the subscription. Use a queue or stream when messages must be held while consumers are offline.
When to Use Subscriptions
Use a subscription for:
- Live notifications
- Dashboards
- Chat or collaboration updates
- Online device or application state
Use a shared subscription when multiple active consumers should share real-time processing.
If consumers need replay or offline recovery, use a stream or queue, or combine the subscription with a durable destination.