CodeChavez.EventBus.MQTT.Abstractions
1.0.0-preview004
dotnet add package CodeChavez.EventBus.MQTT.Abstractions --version 1.0.0-preview004
NuGet\Install-Package CodeChavez.EventBus.MQTT.Abstractions -Version 1.0.0-preview004
<PackageReference Include="CodeChavez.EventBus.MQTT.Abstractions" Version="1.0.0-preview004" />
<PackageVersion Include="CodeChavez.EventBus.MQTT.Abstractions" Version="1.0.0-preview004" />
<PackageReference Include="CodeChavez.EventBus.MQTT.Abstractions" />
paket add CodeChavez.EventBus.MQTT.Abstractions --version 1.0.0-preview004
#r "nuget: CodeChavez.EventBus.MQTT.Abstractions, 1.0.0-preview004"
#:package CodeChavez.EventBus.MQTT.Abstractions@1.0.0-preview004
#addin nuget:?package=CodeChavez.EventBus.MQTT.Abstractions&version=1.0.0-preview004&prerelease
#tool nuget:?package=CodeChavez.EventBus.MQTT.Abstractions&version=1.0.0-preview004&prerelease
CodeChavez.EventBus.MQTT
A comprehensive .NET 10 Event Bus library for MQTT messaging that provides simplified connection management, subscription handling, and event publishing capabilities using MQTTnet.
Overview
CodeChavez.EventBus.MQTT is a modular event bus library that simplifies MQTT client operations with built-in logging and configuration management. It provides an abstraction layer over MQTTnet, making it easy to integrate MQTT messaging patterns (pub/sub, event bus) into your .NET applications.
Packages
This project provides two NuGet packages:
- CodeChavez.EventBus.MQTT.Abstractions (v1.0.0-preview004) - Interfaces and abstractions for MQTT implementations
- CodeChavez.EventBus.MQTT (v1.0.0-preview004) - Full implementation of the MQTT event bus
Features
- Simple Connection Management - Easily connect to MQTT brokers with configurable options
- Subscription Management - Subscribe to MQTT topics with event handling
- Event Publishing - Publish messages to MQTT topics through the event bus pattern
- Logging Support - Built-in logging for debugging and monitoring
- Configuration Options - Flexible configuration through dependency injection
- Async/Await Support - Fully asynchronous operations
- Nullable Reference Types - Full nullable reference type support for safer code
- Implicit Usings - Streamlined using statements for .NET 10
Installation
Add the CodeChavez.EventBus.MQTT NuGet package to your project:
dotnet add package CodeChavez.EventBus.MQTT
Or, if you only need the abstractions:
dotnet add package CodeChavez.EventBus.MQTT.Abstractions
Quick Start
Configuration
First, configure your MQTT options in your dependency injection container:
services.Configure<ConsumerMqttOptions>(configuration.GetSection("MqttConfig"));
services.AddScoped<IEventBusMqttClient, EventBusMqttClient>();
Usage Example
public class MqttService
{
private readonly IEventBusMqttClient _mqttClient;
private IMqttClient _client;
public MqttService(IEventBusMqttClient mqttClient)
{
_mqttClient = mqttClient;
}
public async Task ConnectAsync()
{
// Connect to MQTT broker
_client = await _mqttClient.ConnectAsync("my-client-id");
}
public async Task SubscribeAsync(string topic)
{
// Subscribe to a topic
await _mqttClient.SubscribeAsync(topic);
}
public async Task DisconnectAsync()
{
// Disconnect from MQTT broker
if (_client != null)
{
await _mqttClient.DisconnectAsync(_client);
}
}
}
Configuration Example
Add the following to your appsettings.json:
{
"MqttConfig": {
"Host": "mqtt.example.com",
"Port": 1883,
"Consumer": {
"ClientId": "my-mqtt-client",
"KeepAlivePeriod": 60,
"CleanSession": true
}
}
}
Requirements
- .NET 10 or higher
- MQTTnet 5.1.0.1559 or higher
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on CodeChavez.EventBus.MQTT.Abstractions:
| Package | Downloads |
|---|---|
|
CodeChavez.EventBus.MQTT
Event Bus MQTT is a wrapper using MQTTNet to connect to MQTT Brokers. This allow for modularity |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-preview004 | 38 | 3/26/2026 |
| 1.0.0-preview003 | 43 | 3/25/2026 |
| 1.0.0-preview002 | 43 | 3/17/2026 |
| 1.0.0-preview001 | 39 | 3/17/2026 |