FluxFlow.Components.Mqtt
3.0.0
See the version list below for details.
dotnet add package FluxFlow.Components.Mqtt --version 3.0.0
NuGet\Install-Package FluxFlow.Components.Mqtt -Version 3.0.0
<PackageReference Include="FluxFlow.Components.Mqtt" Version="3.0.0" />
<PackageVersion Include="FluxFlow.Components.Mqtt" Version="3.0.0" />
<PackageReference Include="FluxFlow.Components.Mqtt" />
paket add FluxFlow.Components.Mqtt --version 3.0.0
#r "nuget: FluxFlow.Components.Mqtt, 3.0.0"
#:package FluxFlow.Components.Mqtt@3.0.0
#addin nuget:?package=FluxFlow.Components.Mqtt&version=3.0.0
#tool nuget:?package=FluxFlow.Components.Mqtt&version=3.0.0
FluxFlow.Components.Mqtt
Standalone MQTT nodes for FluxFlow, built on the FluxFlow.Nodes
kit. No engine, registry, or runtime: new a connection handle and the publish /
subscribe nodes, LinkTo their broadcast ports, and run.
The package does not include a concrete network client. Applications supply an
IMqttClientFactory (and the IMqttClientAdapter it produces) for the connection to
establish.
Nodes
| Node | Shape | Purpose |
|---|---|---|
MqttConnectionNode |
resource handle, Events out |
Owns the MQTT client lifecycle (profile + reconnect policy). Publish and subscribe borrow the established adapter by reference. |
MqttPublishNode |
FlowNode<MqttPublishRequest, MqttPublishResult> |
Publishes a request through the borrowed adapter and emits a result carrying the same correlation id. |
MqttSubscribeNode |
FlowSource<MqttReceivedMessage> |
Opens a subscription on the borrowed adapter and emits each received message. |
Publish and subscribe are ordinary kit nodes: a bounded Input (publish), broadcast
Output, Errors, and Events ports. The connection is a resource, not a dataflow
node — it has no data ports, only a broadcast Events stream that reports connection
health.
Connection (host-driven)
MqttConnectionNode owns the single client lease, connection epoch, and health
monitor. Connecting is an explicit host decision: there is no auto-connect or lazy
connect. The host establishes and tears down the client through
IMqttConnectionHandle:
var connection = new MqttConnectionNode(
connectionName: "broker",
profile: new MqttConnectionProfile { Host = "broker.internal.example", Port = 1883 },
reconnect: new MqttReconnectPolicy { Enabled = true, MaxAttempts = 5 },
clientFactory: appClientFactory);
await connection.ConnectAsync(cancellationToken);
// ... run the graph ...
await connection.DisconnectAsync(cancellationToken);
await connection.DisposeAsync();
ConnectAsync is idempotent (a no-op when already connected) and single-flight (a
concurrent call awaits the in-flight connect rather than starting a second).
DisconnectAsync/DisposeAsync cancel an in-flight connect and never leak a freshly
built lease, even when a teardown wins the race mid-CreateAsync. Publish and
subscribe borrow the established adapter via TryGetAdapter and never connect or
dispose it; a borrow only succeeds while the connection is Connected.
Return MqttClientLease.Owned(adapter) from the factory when the connection should
dispose the adapter; return MqttClientLease.Shared(adapter) when the host owns a
shared client lifetime.
Publish
var publish = new MqttPublishNode(
connection,
new MqttPublishOptions { DefaultTopic = "devices/state", QualityOfService = MqttQualityOfService.AtLeastOnce });
publish.Output.LinkTo(resultSink);
await publish.Input.SendAsync(FlowMessage.Create(new MqttPublishRequest
{
Topic = "devices/temperature",
Payload = payloadBytes,
CorrelationId = "abc"
}));
The result carries the inbound FlowMessage correlation id forward. When no client is
established the request reports MqttErrorCodes.PublishNotConnected on Errors (it is
not thrown) and the node continues with later requests. Each adapter publish is bounded
by publishTimeoutMilliseconds (default 30000), so a hung adapter cannot wedge the
node.
Subscribe
var subscribe = new MqttSubscribeNode(
connection,
new MqttSubscriptionOptions { TopicFilter = "devices/+/state" });
subscribe.Output.LinkTo(messageSink);
await subscribe.StartAsync();
The source waits for the connection to become Connected, opens an IMqttSubscription,
and emits a FlowMessage<MqttReceivedMessage> for each message — flowing the
adapter-supplied correlation id when present. It (re)subscribes on each new connection
lease, deduped per connection epoch, so a within-lease Reconnecting -> Connected blip
does not resubscribe. The subscription (never the adapter) is disposed when the
connection drops or the node stops.
Connection health
Adapters that also implement IMqttClientHealthSource can expose connection health
transitions. MqttConnectionNode forwards those on its Events port as
FlowEvents named mqtt.connection.healthChanged, with the health state mapped to a
FlowEventLevel and the health attributes carried through.
Runtime timing
Pass a TimeProvider to any node when tests or hosts need deterministic package-owned
timestamps (the publish result timestamp and the FlowEvent.Timestamp values).
Incoming MqttReceivedMessage.Timestamp and adapter-provided
MqttClientHealthEvent.Timestamp values stay adapter-owned.
Topic validation
Use MqttTopicValidator.ValidatePublishTopic and
MqttTopicValidator.ValidateSubscriptionFilter when projecting host settings or
building requests. Publish topics must be present and cannot contain MQTT wildcards.
Subscription filters may use + as a complete level and # only as the final complete
level. Both helpers reject null characters and oversized encoded topics.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- FluxFlow.Components.RequestReply (>= 1.0.0)
- FluxFlow.Nodes (>= 1.0.0)
-
net8.0
- FluxFlow.Components.RequestReply (>= 1.0.0)
- FluxFlow.Nodes (>= 1.0.0)
- System.Threading.Tasks.Dataflow (>= 9.0.4)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on FluxFlow.Components.Mqtt:
| Package | Downloads |
|---|---|
|
FluxFlow.Components.Mqtt.PulseMqtt
Concrete MQTT transport adapter for FluxFlow. Maps resolved client configuration, exact message bytes, subscriptions, and broker acknowledgements while the provider-neutral MQTT core owns client policy and workflow behavior. |
|
|
FluxFlow.Components.Mqtt.MqttNet
Concrete MQTT transport adapter for FluxFlow. Maps resolved client configuration, exact message bytes, subscriptions, and broker acknowledgements while the provider-neutral MQTT core owns client policy and workflow behavior. |
|
|
FluxFlow.Components.Mqtt.Composition
Canonical FluxFlow Composition resources and nodes for provider-neutral MQTT client control, publication, subscriptions, and client events. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 8.0.0-rc.1 | 114 | 9/5/2026 |
| 7.1.0 | 193 | 8/9/2026 |
| 7.0.0 | 209 | 8/3/2026 |
| 4.1.4 | 177 | 7/3/2026 |
| 4.1.3 | 238 | 7/2/2026 |
| 4.0.0 | 183 | 6/20/2026 |
| 3.0.0 | 128 | 6/19/2026 |
| 2.0.0 | 147 | 6/18/2026 |
| 1.2.1 | 126 | 6/15/2026 |
| 1.2.0 | 428 | 6/12/2026 |
| 1.1.0 | 127 | 6/5/2026 |
| 1.0.0 | 126 | 6/4/2026 |
| 0.5.0-alpha.1 | 252 | 6/3/2026 |
| 0.4.0-alpha.1 | 80 | 6/2/2026 |
| 0.3.0-alpha.1 | 78 | 6/2/2026 |
| 0.2.2-alpha.1 | 84 | 6/2/2026 |
| 0.2.1-alpha.1 | 135 | 5/31/2026 |
| 0.2.0-alpha.1 | 83 | 5/31/2026 |
| 0.1.0-alpha.1 | 83 | 5/31/2026 |
Rebuilt as standalone nodes over the FluxFlow.Nodes kit: the engine and designer dependencies are removed. mqtt.connection becomes a self-contained connection handle (IMqttConnectionHandle) that owns the single client lease, epoch, health monitor, and host-driven ConnectAsync/DisconnectAsync lifecycle, exposing connection health on a broadcast FlowEvent port; the carefully hardened gate/single-flight/lease-ordering/dispose-race concurrency is unchanged. mqtt.publish becomes a FlowNode (MqttPublishRequest in, MqttPublishResult out) and mqtt.subscribe a FlowSource (MqttReceivedMessage out); both borrow the established adapter when connected (subscribe (re)subscribes per connection epoch) and report not-connected on the error port otherwise, never connecting or disposing. NodeAddress is dropped; the connection identity is its ConnectionName. The node registration module, factories, ports, options reader, component types, and design-metadata provider are removed. Contracts, options, topic validation, and diagnostics are preserved. The MQTT request/reply trigger (formerly the separate FluxFlow.Components.Mqtt.RequestReply package) is now folded into this single MQTT package: MqttRequestContext writes the correlated reply to the MQTT5 response topic via a host-supplied IMqttResponsePublisher, driving the transport-neutral RequestReplyCoordinator.