Class MqttDeviceTransport

Namespace
ProtoTest.Devices.Mqtt
Assembly
ProtoTest.Devices.Mqtt.dll

Talks to devices over MQTT: the device's address names the broker, the endpoint settings (or the address query, for a hand-registered endpoint) name the publish and subscribe topics, and the transport keeps one broker connection per device instance. A send publishes to the device's publish topic, a receive yields the next message delivered to its subscribe filter; the broker is the simulator in CI or the real one behind the lab.

public sealed class MqttDeviceTransport : IProtoDeviceTransport
Inheritance
MqttDeviceTransport
Implements
Inherited Members
Extension Methods

Constructors

MqttDeviceTransport(MqttDeviceOptions)

Creates the transport with the run's MQTT options.

public MqttDeviceTransport(MqttDeviceOptions options)

Parameters

options MqttDeviceOptions

Fields

TransportName

The transport's name, as registrations and configuration refer to it.

public const string TransportName = "Mqtt"

Field Value

string

Properties

Name

Gets the transport's name, as configuration and registrations refer to it.

public string Name { get; }

Property Value

string

Methods

ConnectAsync(ProtoExecutionContext, DeviceEndpoint, CancellationToken)

Connects to a device endpoint for a specific test context. The default forwards to ConnectAsync(DeviceEndpoint, CancellationToken); a transport that routes on the test's own state - the in-process TestServer transport - overrides this instead of re-reading ambient host state at connect time, so a connection started on another flow still reaches the application the routing decision was made for.

public ValueTask<IProtoDeviceConnection> ConnectAsync(ProtoExecutionContext context, DeviceEndpoint endpoint, CancellationToken cancellationToken = default)

Parameters

context ProtoExecutionContext
endpoint DeviceEndpoint
cancellationToken CancellationToken

Returns

ValueTask<IProtoDeviceConnection>

ConnectAsync(DeviceEndpoint, CancellationToken)

Connects to a device endpoint; the connection is opened lazily on first use.

public ValueTask<IProtoDeviceConnection> ConnectAsync(DeviceEndpoint endpoint, CancellationToken cancellationToken = default)

Parameters

endpoint DeviceEndpoint
cancellationToken CancellationToken

Returns

ValueTask<IProtoDeviceConnection>