apache / apache/shenyu

[BUG] Wildcard subscription matching not implemented — +/-# subscriptions never receive messages

Open
#6,851 2 comments 0 reactions 1 assignee Claimed by @wy471x View on GitHub
plugin: mqtt priority: high type: bug
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

## Description
Subscriptions containing `+` (single-level) or `#` (multi-level) are stored under the literal wildcard string and never matched against published topic names; the matcher is an explicit TODO. `Publish.send` looks up `SubscribeRepository.get(topic)` with the literal published topic (plain `ConcurrentHashMap.getOrDefault` exact-key lookup).

## Location
- `shenyu-protocol/shenyu-protocol-mqtt/src/main/java/org/apache/shenyu/protocol/mqtt/Subscribe.java:63` (`// todo Regular match`)
- `shenyu-protocol/shenyu-protocol-mqtt/src/main/java/org/apache/shenyu/protocol/mqtt/repositories/SubscribeRepository.java:90-92`

## Impact
Wildcard subscriptions never receive any message — a core MQTT feature is silently broken.

## Suggested fix
Implement topic-filter matching per MQTT-4.7 (`+` single level, `#` multi-level at end) and match published topics against all stored filters on each PUBLISH.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.