📮
MqttTopicBuilder
  • MqttTopicBuilder
  • Creating a new topic
Powered by GitBook
On this page
  • Overview
  • Why ?
  • Installation
  • NuGet package
  • Local clone

Was this helpful?

MqttTopicBuilder

Build valid and verified MQTT topics

NextCreating a new topic

Last updated 4 years ago

Was this helpful?

Overview

MqttTopicBuilder is a library that aims to provide a robust context for MQTT topics handling for developers.

Made with .NET Standard 2.0, chances are that (Minimum supported platforms: .NET Core 2.0+ and .NET Framework 4.6.1)

You can use it seamlessly in your application, both for your subscribers and publishers by using the builder's fluent API:

var topic = new TopicBuilder(TopicConsumer.Subscriber)
    .AddTopic("Hello")
    .AddTopic("From")
    .AddTopics("Mqtt", "Topic", "Builder")
    .AddMultiLevelWildcard()
    .Build();

Console.WriteLine(topic);
// -> "Hello/From/Mqtt/Topic/Builder/#"

Why ?

MQTT topics are raw strings by default. However, they do embed quite a lot of logic such as their level, wildcards or even their own structure. Moreover, they have to follow , which can be a burden to developers to test, parse or maintain.

MqttTopicBuilder provides a bunch of tools in order to help developers to manipulate strongly typed MQTT topics objects instead of those strings.

This tools also handle all compliance checks with the MQTT specification regarding how the topic should be built: let us spend time on the tedious tasks so you can use more of yours to build awesome and robust applications !

Installation

NuGet package

Install-Package MqttTopicBuilder

You can also use the dotnet cli

dotnet add package MqttTopicBuilder

Local clone

To set up your own clone, simply clone the project from the main repository (or from your own fork)

git clone https://github.com/pBouillon/MqttTopicBuilder

In order to use this library, you should use

your application will be compatible
some very strict rules
MqttTopicBuilder with NuGet