Class MosquittoBroker

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

A Mosquitto container owned by the whole run: started once for the suite and released when the host is disposed, after the run has stopped and the reports are written. Register it as a UseContainer(...) provider of the target that declares MqttDeviceOptions.BrokerSetting, so the broker address reaches the MQTT clients through the one settings key - the same shape as the RabbitMQ and PostgreSQL containers.

public sealed class MosquittoBroker : ProtoContainerResource<MosquittoContainer>, IProtoConnectionInfrastructure, IProtoConfiguredInfrastructure, IProtoInfrastructure, IProtoResource, IProtoStartupEvidence, IAsyncDisposable
Inheritance
ProtoContainerResource<MosquittoContainer>
MosquittoBroker
Implements
Inherited Members
Extension Methods

Properties

Description

Gets a single line describing the resource for the trace, report and viewer.

public override string Description { get; }

Property Value

string

Id

Gets the stable identity of the resource, for example customer:42.

public override string Id { get; }

Property Value

string

Kind

Gets the resource kind, for example database or entity.

public override string Kind { get; }

Property Value

string

Methods

Container(Action<MosquittoBuilder>?)

Creates the resource without starting it; the host starts it with the run.

public static MosquittoBroker Container(Action<MosquittoBuilder>? configure = null)

Parameters

configure Action<MosquittoBuilder>

Returns

MosquittoBroker

Start(Action<MosquittoBuilder>?)

Starts a container now, or throws with the reason it could not start.

public static MosquittoBroker Start(Action<MosquittoBuilder>? configure = null)

Parameters

configure Action<MosquittoBuilder>

Returns

MosquittoBroker

TryStart(Action<MosquittoBuilder>?)

Starts a container, reporting why it could not start instead of throwing - a machine without a container runtime should be able to fall back or skip rather than fail the run.

public static ContainerStartResult<MosquittoBroker> TryStart(Action<MosquittoBuilder>? configure = null)

Parameters

configure Action<MosquittoBuilder>

Returns

ContainerStartResult<MosquittoBroker>