Skip to content

mqtt-kafka: a trailing empty topic level is lost when topic names and filters are split #3260

Closed

Description

@jfallows

Problem

From the conformance audit (by reading; not run): both the publish and the subscribe side of mqtt-kafka split topics with String.split("/"), which drops a trailing empty string. So a/ is treated as a, a filter a/+ can never match the topic a/, and a subscriber of a can receive the topic a/ (MqttKafkaPublishFactory about line 399, MqttKafkaSubscribeFactory about line 2835).

Specification statements (to be re-read from the OASIS text before writing scripts)

  • MQTT 5.0 4.7.1 Topic wildcards and 3.1.1 4.7.1: topic levels, and that "a/" and "a" are different topic names ("Adjacent Topic level separators indicate a zero length topic level"; quote the sentences with their ids).

Expected

  • A topic name or filter keeps its trailing empty level: a/ and a are different topics, a/+ matches a/ and not a.
  • The fix mirrors how other splits of topic strings in the same binding keep empty levels, if any; otherwise use the split form that keeps trailing empty strings and say so.

First step (verify before changing code)

Write scripts: publish to a/ with a subscriber of a, and a subscriber of a/+ with a publish to a/; for any case that already behaves as the text requires, say so with the passing run and do not change code for it.

Test plan (test-first)

Script pairs in specs/binding-mqtt-kafka.spec and runtime ITs in the existing mqtt-kafka proxy IT classes; first commit the failing tests, run with a hard timeout.

Notes

Part of the MQTT conformance work under #512, from the audit section "Topics and string validation" (gap 5, a bug).

Activity

  1. self-assigned this
    on Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions