ProSol.Messaging 3.0.0

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

// Install ProSol.Messaging as a Cake Tool
#tool nuget:?package=ProSol.Messaging&version=3.0.0

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. 
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 434 12/8/2023
4.0.0-rc.9.0 67 12/7/2023
4.0.0-rc.8.0 51 12/7/2023
4.0.0-rc.7.4 59 12/5/2023
4.0.0-rc.7.3 56 12/5/2023
4.0.0-rc.7.2 64 12/5/2023
4.0.0-rc.7.1 61 12/5/2023
4.0.0-rc.7.0 63 12/5/2023
4.0.0-rc.6.0 70 12/2/2023
4.0.0-rc.5.1 60 11/30/2023
4.0.0-rc.5.0 54 11/30/2023
4.0.0-rc.3.0 68 11/24/2023
4.0.0-rc.2 62 11/24/2023
4.0.0-rc.1 69 11/24/2023
3.0.1 117 11/24/2023
3.0.0 121 11/22/2023
3.0.0-rc.0.2 57 11/21/2023
3.0.0-rc.0.1 54 11/20/2023
2.0.0 115 11/19/2023
1.0.0 100 11/16/2023