$linuxjunkies
>

wildcard topic

also: topic pattern, topic subscription wildcard

A wildcard topic is a subscription pattern in message brokers that matches multiple topics using special characters like * and #, allowing a single subscriber to receive messages from related topics without subscribing to each individually.

In distributed messaging systems like MQTT or RabbitMQ, wildcard topics enable flexible subscription patterns where subscribers can listen to groups of topics simultaneously. The most common wildcards are * (single-level wildcard) and # (multi-level wildcard).

For example, in MQTT, subscribing to home/+/temperature matches home/kitchen/temperature and home/bedroom/temperature, but not home/kitchen/sensors/temperature. The # wildcard is greedy: home/# matches all topics starting with home/ at any depth.

This pattern is particularly useful in IoT and microservices architectures where you need to handle multiple related message streams—for instance, a monitoring service could subscribe to devices/+/status to track all device statuses without hardcoding individual device names.

Related terms