ProSol.Messaging 3.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package ProSol.Messaging --version 3.0.1
                    
NuGet\Install-Package ProSol.Messaging -Version 3.0.1
                    
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="ProSol.Messaging" Version="3.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ProSol.Messaging" Version="3.0.1" />
                    
Directory.Packages.props
<PackageReference Include="ProSol.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 ProSol.Messaging --version 3.0.1
                    
#r "nuget: ProSol.Messaging, 3.0.1"
                    
#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 ProSol.Messaging@3.0.1
                    
#: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=ProSol.Messaging&version=3.0.1
                    
Install as a Cake Addin
#tool nuget:?package=ProSol.Messaging&version=3.0.1
                    
Install as a Cake Tool

ProSol.Messaging

Implements a message broker with ability to build a pipeline of listeners.

API

The project contains an API for the Observer pattern: IPublisher, ISubscriber, and PipelinePublisher.

  • The IPublisher interface is aimed to provide a layer of absctraction to the client.
  • The ISubscriber interface decalres a subscription contract with chained calls support via NextDelegate.
    • NextDelegate: is a mandatory delegate to trigger if current subscriber wants to bypass a message to next subscriber.
  • PipelinePublisher: a ready-to-use implementation for chained subscriptions.

Demo

Let's see how works in a console app, by making a publisher for strings, which addresses the message to the StringListener, but there is a StringLimitListener between them.

So, the StringLimitListener will drop the message longer than "Please" string:

using ProSol.Messaging;

var maxLength = "Please".Length + 1;

var broker = new MessageBroker<string>();
// Set up a chain.
broker.Subscribe(new StringLimitListener(maxLength));
broker.Subscribe(new StringListener());

// Push some messages.
broker.Publish("Please");
broker.Publish("STOP");
broker.Publish("The planet");
// OUTPUT:
// Please
// STOP

// Clean up.
broker.Complete();
public class StringListener : ISubscriber<string>
{
    public void OnCompleted() { }

    public void OnNext(string message, NextDelegate next)
    {
        Console.WriteLine(message);

        if (message != "STOP")
        {
            next();
        }
    }
}
public class StringLimitListener(int limit) : ISubscriber<string>
{
    private readonly int limit = limit;

    public void OnCompleted() { }

    public void OnNext(string message, NextDelegate next)
    {
        if (message.Length < limit)
        {
            next();
        }
    }
}
Product 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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on ProSol.Messaging:

Package Downloads
ProSol.Html.TagsProvider

TagsProvider is a tool for extracting HTML tags from a string, in event-driven way. Helps to extract text, structured data, from a specific site.

ProSol.WebScrap

A HTML parser, for extracting the text from a web pages, with CSS selectors.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.0 649 12/8/2023
4.0.0-rc.9.0 126 12/7/2023
4.0.0-rc.8.0 136 12/7/2023
4.0.0-rc.7.4 143 12/5/2023
4.0.0-rc.7.3 110 12/5/2023
4.0.0-rc.7.2 122 12/5/2023
4.0.0-rc.7.1 123 12/5/2023
4.0.0-rc.7.0 117 12/5/2023
4.0.0-rc.6.0 134 12/2/2023
4.0.0-rc.5.1 119 11/30/2023
4.0.0-rc.5.0 120 11/30/2023
4.0.0-rc.3.0 128 11/24/2023
4.0.0-rc.2 118 11/24/2023
4.0.0-rc.1 118 11/24/2023
3.0.1 236 11/24/2023
3.0.0 232 11/22/2023
3.0.0-rc.0.2 117 11/21/2023
3.0.0-rc.0.1 118 11/20/2023
2.0.0 236 11/19/2023
1.0.0 181 11/16/2023