Class MqttMockTransportHost
- Namespace
- Kuestenlogik.Bowire.Protocol.Mqtt.Mock
- Assembly
- Kuestenlogik.Bowire.Protocol.Mqtt.dll
MQTT transport host for the Bowire mock server. Spins up an embedded MQTTnet broker on its own port, then orchestrates the proactive emitter (replays captured publishes) and the reactive responder (matches incoming publishes against pattern-based recordings and emits paired responses).
public sealed class MqttMockTransportHost : IBowireMockTransportHost, IAsyncDisposable
- Inheritance
-
MqttMockTransportHost
- Implements
- Inherited Members
Remarks
Discovered as IBowireMockTransportHost via the standard plugin-load pass. The mock server iterates every registered host at startup, calls ShouldStart(BowireRecording) against the loaded recording, and starts the ones that say yes. The MQTTnet dependency lives entirely on this plugin — Kuestenlogik.Bowire.Mock has no compile-time knowledge of MQTT after the plugin-isation refactor.
Constructors
MqttMockTransportHost()
public MqttMockTransportHost()
Properties
Id
Stable transport id surfaced in logs and in
MockServer.TransportPorts. Use the same id the recording
step's protocol field carries, lower-case (e.g.
"mqtt", "amqp").
public string Id { get; }
Property Value
Methods
DisposeAsync()
public ValueTask DisposeAsync()
Returns
ShouldStart(BowireRecording)
Decide whether StartAsync(BowireRecording, MockTransportContext, CancellationToken) should be called for the
given recording — typically by scanning for steps whose
protocol matches Id. Hosts that return
false are skipped silently (no port allocation, no log
noise).
public bool ShouldStart(BowireRecording recording)
Parameters
recordingBowireRecording
Returns
Remarks
ServerStreaming steps count too (#511): a captured MQTT
subscription carries the delivered publishes as
receivedMessages frames, and the proactive emitter
re-injects those into the broker on their recorded cadence —
without the broker a mock subscriber could never see them.
StartAsync(BowireRecording, MockTransportContext, CancellationToken)
Start the transport listener. Implementations are responsible for binding the port (using RequestedPort when non-zero, or picking an OS-assigned port when zero) and returning the actually-bound port number.
public Task<int> StartAsync(BowireRecording recording, MockTransportContext context, CancellationToken ct)
Parameters
recordingBowireRecordingcontextMockTransportContextctCancellationToken
Returns
StopAsync(CancellationToken)
Stop the transport. Called during MockServer shutdown — close listeners, release resources, drop scheduled tasks.
public Task StopAsync(CancellationToken ct)