Meta.Lib 2.0.2

dotnet add package Meta.Lib --version 2.0.2                
NuGet\Install-Package Meta.Lib -Version 2.0.2                
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="Meta.Lib" Version="2.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Meta.Lib --version 2.0.2                
#r "nuget: Meta.Lib, 2.0.2"                
#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 Meta.Lib as a Cake Addin
#addin nuget:?package=Meta.Lib&version=2.0.2

// Install Meta.Lib as a Cake Tool
#tool nuget:?package=Meta.Lib&version=2.0.2                

Meta.Lib

MetaPubSub is an implementation of the publish/subscribe pattern, enabling message exchange between publishers and subscribers without direct dependencies. It is fast, lightweight, and offers several advanced features:

  • Interprocess communication – Messages can be sent between different processes and computers.
  • Awaitable methods – You can await Publish and wait until all subscribers have processed the message.
  • At-least-once delivery check – Optionally, throw an exception if no subscribers receive the message.
  • Message filtering – Subscribe only to specific messages using a predicate.
  • Subscriber wait timeout – Messages can be queued until a subscriber processes them.
  • Scheduled messages – Messages can be queued and published after a delay.
  • Request-response pattern – Send a message and wait for a response in a single awaitable method without needing to Subscribe/Unsubscribe.
  • Cancellation token support – Cancel scheduled messages or waiting for a response.
  • Exception handling – Exceptions raised during message processing can be caught by the publisher as an AggregateException.

MetaPipeServer and MetaPipeConnection

These components simplify interprocess communication using named pipes. They leverage NamedPipeServerStream and NamedPipeClientStream for message transmission, with System.Text.Json for object serialization. Features include:

  • Automatic connection recovery in case of disconnection.
  • Support for multiple data types, including strings, byte arrays, and objects.
  • Synchronous request-response support – Send an object and wait for a response in a single method call.

PubSubPipe

PubSubPipe extends MetaPubSub, enabling message exchange between processes or computers.

StateMachine

A simple, thread-safe state machine implementation suitable for concurrent environments. See MetaPipeConnection for a usage example.

NuGet Package

To install Meta.Lib, run:

PM> Install-Package Meta.Lib

How to Use

FAQ


Changelog

Version 2.0.2

  • Added MetaPubSub property to IPubSubPipeClient.
  • Added Connected and Disconnected events.

Version 2.0.1

  • Updated packages to .Net 9.

Version 2.0.0

Breaking changes – See the migration guide.

  • MetaPubSub has been split into three modules:
    • PubSub – Local publish/subscribe implementation.
    • Pipe – Wrapper for NamedPipeServerStream and NamedPipeClientStream to simplify interprocess communication.
    • PubSubPipe – Combines PubSub and Pipe to enable interprocess communication for PubSub.
  • Added ConcurrentStateMachine.
  • Replaced custom Logger with ILogger from Microsoft.Extensions.Logging.
  • Removed IPubSubMessage interface (messages no longer need to implement it).
  • Performance improvements.

Version 1.1.3

Breaking changes:

  • Renamed IPubSubMessage.Timeout to WaitForSubscriberTimeout.
  • Added IPubSubMessage.ResponseTimeout – Defines the time interval to receive a response before throwing a TimeoutException. Used in IMetaPubSub.Process() and IMetaPubSub.ProcessOnServer().
  • Removed millisecondsTimeout from IMetaPubSub.Process() and IMetaPubSub.ProcessOnServer(). Use IPubSubMessage.ResponseTimeout instead.
  • Fixed bug where IMetaPubSub.Process() and IMetaPubSub.ProcessOnServer() always used the default timeout of 5 seconds.

Version 1.1.2

  • Added TryConnectToServer and TrySubscribeOnServer.
  • Added a match predicate to SubscribeOnServer.
  • Introduced built-in Connected/Disconnected messages.
  • Added a delegate method for creating pipes with custom parameters.

Version 1.1.1

  • Implemented interprocess communication.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
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
2.0.2 80 2/5/2025
2.0.1 48 1/8/2025
2.0.0-beta 272 3/9/2023
1.1.3 1,074 10/27/2020
1.1.2 504 7/22/2020
1.1.1 486 7/21/2020
1.1.0 503 7/3/2020
1.0.1 435 5/26/2020
1.0.0 465 5/7/2020

- Added MetaPubSub property to the IPubSubPipeClient;
- Added Connected and Disconnected events to the IPubSubPipeClient;