MakoIoT.Device.Services.Messaging 1.0.72.37069

There is a newer version of this package available.
See the version list below for details.
dotnet add package MakoIoT.Device.Services.Messaging --version 1.0.72.37069
                    
NuGet\Install-Package MakoIoT.Device.Services.Messaging -Version 1.0.72.37069
                    
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.72.37069" />
                    
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.72.37069" />
                    
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.72.37069
                    
#r "nuget: MakoIoT.Device.Services.Messaging, 1.0.72.37069"
                    
#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.
#addin nuget:?package=MakoIoT.Device.Services.Messaging&version=1.0.72.37069
                    
Install MakoIoT.Device.Services.Messaging as a Cake Addin
#tool nuget:?package=MakoIoT.Device.Services.Messaging&version=1.0.72.37069
                    
Install MakoIoT.Device.Services.Messaging 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.79.42931 130 4/23/2025
1.0.78.42041 177 4/17/2025
1.0.77.58336 162 4/3/2025
1.0.76.47396 146 4/2/2025
1.0.75.54889 142 3/20/2025
1.0.74.58895 159 3/11/2025
1.0.73.3184 160 3/10/2025
1.0.72.37069 207 3/3/2025
1.0.71.58660 112 2/27/2025
1.0.67.58431 112 2/22/2025
1.0.66.61791 97 2/20/2025
1.0.65.9968 106 2/18/2025
1.0.63.58350 106 11/28/2024
1.0.62.39147 92 11/27/2024
1.0.61.65061 102 11/26/2024
1.0.60.8871 100 11/25/2024
1.0.59.39628 101 11/19/2024
1.0.58.46908 106 10/31/2024
1.0.57.41830 146 10/19/2024
1.0.56.35619 144 10/18/2024
1.0.55.53831 102 10/16/2024
1.0.54.17802 100 9/30/2024
1.0.53.63834 103 9/26/2024
1.0.52.58630 118 9/20/2024
1.0.51.33981 127 9/12/2024
1.0.50.7227 119 9/5/2024
1.0.49.65299 116 8/28/2024
1.0.48.4709 115 8/27/2024
1.0.47.29483 134 8/11/2024
1.0.46.26755 121 8/10/2024
1.0.45.44465 91 8/5/2024
1.0.44.59575 119 6/12/2024
1.0.43.12089 119 5/18/2024
1.0.42.33950 128 5/17/2024
1.0.41.841 140 4/9/2024
1.0.40.35009 122 4/8/2024
1.0.39.27363 128 4/3/2024
1.0.38.33544 129 3/22/2024
1.0.37.6157 119 3/21/2024
1.0.36.17910 197 1/6/2024
1.0.35.19216 153 12/30/2023
1.0.34.20615 162 12/2/2023
1.0.33.8822 144 12/1/2023
1.0.32.53741 156 11/17/2023
1.0.31.63629 134 11/11/2023
1.0.30.34678 134 11/11/2023
1.0.29.45728 131 10/9/2023
1.0.28.38941 153 10/6/2023
1.0.27.18901 149 10/4/2023
1.0.25.29211 195 5/29/2023
1.0.24.44332 171 5/25/2023
1.0.20.4309 159 5/22/2023
1.0.19.42541 164 5/22/2023