Skip to content

[feat][mqtt] Support dynamic MQTT topic via topicProperty config#34

Open
Dream95 wants to merge 1 commit into
apache:masterfrom
Dream95:improve_dynaminc-mqtt-topic
Open

[feat][mqtt] Support dynamic MQTT topic via topicProperty config#34
Dream95 wants to merge 1 commit into
apache:masterfrom
Dream95:improve_dynaminc-mqtt-topic

Conversation

@Dream95

@Dream95 Dream95 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Motivation

In MQTT IoT setups, messages are often routed per device to topics like /data/{deviceId} or sensor/{deviceId}/telemetry. Each device may need its own MQTT topic instead of a single shared one.

MqttSink only supports a fixed topic in configuration today, so it cannot choose the destination topic per message from device identity.

Solution

Add an optional topicProperty setting to MqttSink. It names the Pulsar message property that holds the target MQTT topic.

When topicProperty is set, the sink reads that key from record.getProperties() and uses the value as the publish topic. If topicProperty is unset, or the property is missing or blank on a message, the sink uses the configured topic. Existing configs that only set the topic behave the same as before.

Signed-off-by: Dream95 <zhou_8621@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant