Class MqttReactiveResponder
- Namespace
- Kuestenlogik.Bowire.Protocol.Mqtt.Mock
- Assembly
- Kuestenlogik.Bowire.Protocol.Mqtt.dll
MQTT reactive matcher / responder. Watches incoming client
publishes via the broker's InterceptingPublishAsync event
and emits paired responses for every recorded step whose topic
pattern matches.
public sealed class MqttReactiveResponder : IDisposable
- Inheritance
-
MqttReactiveResponder
- Implements
- Inherited Members
Remarks
Recording shape for a reactive MQTT step:
{
"protocol": "mqtt",
"methodType": "Duplex",
"method": "cmd/+/reboot", // topic pattern with wildcards
"metadata": {
"responseTopic": "cmd/${topic.0}/ack", // optional; MQTT v5 ResponseTopic on the incoming publish wins when present
"qos": "1",
"retain": "false"
},
"body": "{\"ack\":true,\"device\":\"${topic.0}\"}"
}
On match:
- Extract wildcard bindings via MqttTopicMatcher
(
+captures by position, trailing#as${topic.rest}). - Resolve the response topic — MQTT v5
ResponseTopicon the incoming publish wins, elsemetadata.responseTopicfrom the step, else no response (fire-and-forget). - Run Substitute(string, IReadOnlyDictionary<string, string>?)
on both the response topic and the payload with the bindings as
extras so
${topic.N}/${topic.rest}get concrete values. - Inject the response via
InjectApplicationMessage(InjectedMqttApplicationMessage, CancellationToken), copying
CorrelationDatafrom the request (MQTT v5) so clients can pair request/response.
Constructors
MqttReactiveResponder(MqttServer, BowireRecording, ILogger)
public MqttReactiveResponder(MqttServer broker, BowireRecording recording, ILogger logger)
Parameters
brokerMqttServerrecordingBowireRecordingloggerILogger
Methods
Dispose()
public void Dispose()
Start()
Hook the broker-intercept event. Call once per emitter lifetime.
public void Start()