Meta.Lib
2.0.2
dotnet add package Meta.Lib --version 2.0.2
NuGet\Install-Package Meta.Lib -Version 2.0.2
<PackageReference Include="Meta.Lib" Version="2.0.2" />
<PackageVersion Include="Meta.Lib" Version="2.0.2" />
<PackageReference Include="Meta.Lib" />
paket add Meta.Lib --version 2.0.2
#r "nuget: Meta.Lib, 2.0.2"
#:package Meta.Lib@2.0.2
#addin nuget:?package=Meta.Lib&version=2.0.2
#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 Publishand 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.
MetaPubSubhas been split into three modules:PubSub– Local publish/subscribe implementation.Pipe– Wrapper forNamedPipeServerStreamandNamedPipeClientStreamto simplify interprocess communication.PubSubPipe– CombinesPubSubandPipeto enable interprocess communication forPubSub.
- Added
ConcurrentStateMachine. - Replaced custom
LoggerwithILoggerfromMicrosoft.Extensions.Logging. - Removed
IPubSubMessageinterface (messages no longer need to implement it). - Performance improvements.
Version 1.1.3
Breaking changes:
- Renamed
IPubSubMessage.TimeouttoWaitForSubscriberTimeout. - Added
IPubSubMessage.ResponseTimeout– Defines the time interval to receive a response before throwing aTimeoutException. Used inIMetaPubSub.Process()andIMetaPubSub.ProcessOnServer(). - Removed
millisecondsTimeoutfromIMetaPubSub.Process()andIMetaPubSub.ProcessOnServer(). UseIPubSubMessage.ResponseTimeoutinstead. - Fixed bug where
IMetaPubSub.Process()andIMetaPubSub.ProcessOnServer()always used the default timeout of 5 seconds.
Version 1.1.2
- Added
TryConnectToServerandTrySubscribeOnServer. - Added a match predicate to
SubscribeOnServer. - Introduced built-in
Connected/Disconnectedmessages. - Added a delegate method for creating pipes with custom parameters.
Version 1.1.1
- Implemented interprocess communication.
| Product | Versions 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. 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. |
| .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. |
-
.NETStandard 2.0
- Microsoft.Extensions.Logging (>= 9.0.0)
- System.Collections.Immutable (>= 9.0.0)
- System.Text.Json (>= 9.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
- Added MetaPubSub property to the IPubSubPipeClient;
- Added Connected and Disconnected events to the IPubSubPipeClient;