MakoIoT.Device.Services.Messaging 1.0.83.12577

dotnet add package MakoIoT.Device.Services.Messaging --version 1.0.83.12577
                    
NuGet\Install-Package MakoIoT.Device.Services.Messaging -Version 1.0.83.12577
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MakoIoT.Device.Services.Messaging" Version="1.0.83.12577" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MakoIoT.Device.Services.Messaging" Version="1.0.83.12577" />
                    
Directory.Packages.props
<PackageReference Include="MakoIoT.Device.Services.Messaging" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MakoIoT.Device.Services.Messaging --version 1.0.83.12577
                    
#r "nuget: MakoIoT.Device.Services.Messaging, 1.0.83.12577"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MakoIoT.Device.Services.Messaging@1.0.83.12577
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MakoIoT.Device.Services.Messaging&version=1.0.83.12577
                    
Install as a Cake Addin
#tool nuget:?package=MakoIoT.Device.Services.Messaging&version=1.0.83.12577
                    
Install as a Cake Tool

Mako-IoT.Device.Services.Messaging

Message bus with pub-sub and stronly typed data contracts.

Main concepts

Message routing

There are two type of routes:

  • Broadcast messages are published under topics and delivered to one or more subscribers. This is usually used for propagating events.
  • Direct message is delivered to single recipient. This is usually used for sending commands. Routing is done automatically based on message types.

Message contracts

Message contracts are classes that implement IMessage interface. MessageType must be set to full type name of the class.

public class BlinkCommand : IMessage
{
    public BlinkCommand()
    {
        MessageType = this.GetType().FullName;
    }
    public bool LedOn { get; set; }
    public string MessageType { get; set; }
}

Consumers

Messages are delivered to consumer classes.

public class BlinkCommandConsumer : IConsumer
{
    private readonly IBlinker _blinker;
    private readonly ILogger _logger;

    public BlinkCommandConsumer(IBlinker blinker, ILogger logger)
    {
        _blinker = blinker;
        _logger = logger;
    }

    public void Consume(ConsumeContext context)
    {
        var cmd = (BlinkCommand)context.Message;
        _logger.LogDebug($"Setting LED to {cmd.LedOn}");
        _blinker.Set(cmd.LedOn);
    }
}

Consumers are registered against message types in DeviceBuilder with AddDirectMessageConsumer or AddSubscriptionConsumer

public static void Main()
{
    DeviceBuilder.Create()
        .AddMessageBus(o =>
        {
            o.AddDirectMessageConsumer(typeof(BlinkCommand), typeof(BlinkCommandConsumer), ConsumeStrategy.LastMessageWins);
        })
   //[...]
Consume strategies

Consuming multiple messages of same type (i.e. by single consumer) may be done in one of three fashions:

  1. Synchronously - receiving subsequent messages is blocked until current message ends processing.
  2. FIFO - received messages are put onto a queue and processed in order.
  3. Last Message Wins - the most recent message is processed and older unprocessed messages are discarded. This equivalent to bulkhead resilience pattern with single concurrent action.

Sending messages

bus.Send(msg, "device1"); //sends direct message to "device1"
bus.Publish(msg); //publishes broadcast message

Interoperability with .NET

With .NET implementation of message bus you can easily communicate between nanoFramework devices and .NET services or application. Data contract classes can be shared across both parties. See messaging sample.

Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.83.12577 265 9/28/2025
1.0.82.41369 184 9/27/2025
1.0.81.31061 240 7/15/2025
1.0.80.20703 238 7/8/2025
1.0.79.42931 291 4/23/2025
1.0.78.42041 299 4/17/2025
1.0.77.58336 289 4/3/2025
1.0.76.47396 266 4/2/2025
1.0.75.54889 306 3/20/2025
1.0.74.58895 330 3/11/2025
1.0.73.3184 292 3/10/2025
1.0.72.37069 317 3/3/2025
1.0.71.58660 237 2/27/2025
1.0.67.58431 239 2/22/2025
1.0.66.61791 226 2/20/2025
1.0.65.9968 234 2/18/2025
1.0.63.58350 231 11/28/2024
1.0.62.39147 202 11/27/2024
1.0.61.65061 226 11/26/2024
1.0.60.8871 222 11/25/2024
Loading failed