mqtt client
mqtt client
The mqtt client binding encodes the MQTT protocol to the outbound network stream.
mqtt_client:
type: mqtt
kind: client
exit: mqtt_client_tcpConfiguration (* required)
options
object
The client specific options.
options:
authorization:
my_jwt_guard:
credentials:
connect:
username: Bearer {credentials}
versions:
- v5
- v3.1.1options.server
string
Upstream MQTT broker URI. When set, its host and port are forwarded to the exit binding as proxy protocol destination info, overriding the destination the exit binding would otherwise use on its own.
options.authorization
objectas map of namedobjectproperties
Authorization by a named guard.
authorization:
my_jwt_guard:
credentials:
connect:
username: Bearer {credentials}authorization.credentials*
object
Defines how to extract credentials from the MQTT connect packet.
credentials.connect*
object
MQTT connect packet properties
connect.username
string
Extract credentials from the MQTT connect packet username property with {credentials}, e.g. "Bearer {credentials}".
connect.password
string
Extract credentials from the MQTT connect packet password property with {credentials}, e.g. "Bearer {credentials}".
routes
arrayofobject
Conditional mqtt specific routes. At least one of routes or the top-level exit is required.
routes[].guarded
objectas map of namedarrayofstring
List of roles required by each named guard to authorize this route.
routes:
- guarded:
my_guard:
- read:itemsroutes[].when
arrayofobject
List of conditions (any match) to match this route. Read more: When a route matches
routes:
- when:
- session:
- client-id: "*"
- publish:
- topic: command/one
- topic: command/two
- subscribe:
- topic: replywhen[].session
arrayofobject
Array of mqtt session properties
session[].client-id
string
An MQTT client identifier, allowing the usage of wildcards.
when[].publish
arrayofobject
Array of MQTT topic configs for publish capability.
publish[].topic
string| Pattern:^(\\/?([\\w{}\\.-]*|\\+)(\\/((?![-_])[\\w{}\\.-]*|\\+))*(\\/#)?|#|\\/|\\$SYS(\\/((?![-_])[\\w{}\\.-]*|\\+))*(\\/#)?)$
The MQTT topic to match on that supports standard MQTT wildcards /+/, /#.
Also, supports embedded parameters (e.g., {id}) for dynamic topic matching.
publish[].params
objectas map of namedstringproperties | Pattern:^[a-zA-Z0-9{}\\[\\]\\.\\$']*$
Enforce validation of topic embedded parameters.
publish:
- topic: device/{id}
params:
id: ${guarded['jwt'].identity}Supports dynamic parameter substitution using the following pattern:
${guarded['jwt'].identity}– Substitutes a guarded identity value.
when[].subscribe
arrayofobject
Array of MQTT topic configs for subscribe capability.
subscribe[].topic
string| Pattern:^(\\/?([\\w{}\\.-]*|\\+)(\\/((?![-_])[\\w{}\\.-]*|\\+))*(\\/#)?|#|\\/|\\$SYS(\\/((?![-_])[\\w{}\\.-]*|\\+))*(\\/#)?)$
The MQTT topic to match on that supports standard MQTT wildcards /+/, /#.
Also, supports embedded parameters (e.g., {id}) for dynamic topic matching.
subscribe[].params
objectas map of namedstringproperties | Pattern:^[a-zA-Z0-9{}\\[\\]\\.\\$']*$
Enforce validation of topic embedded parameters.
subscribe:
- topic: device/{id}
params:
id: ${guarded['jwt'].identity}Supports dynamic parameter substitution using the following pattern:
${guarded['jwt'].identity}– Substitutes a guarded identity value.
routes[].exit
string
Next binding when following this route.
routes:
- when:
...
exit: mqtt_kafka_proxyexit
string
Default exit binding when no conditional routes are viable.
exit: echo_servertelemetry
object
Defines the desired telemetry for the binding.
telemetry.metrics
array
Telemetry metrics to track
telemetry:
metrics:
- stream.*telemetry.attributes
objectas map of namedstringproperties
Telemetry attributes to add to the binding metrics.

