Meta.Lib
2.0.1
See the version list below for details.
dotnet add package Meta.Lib --version 2.0.1
NuGet\Install-Package Meta.Lib -Version 2.0.1
<PackageReference Include="Meta.Lib" Version="2.0.1" />
<PackageVersion Include="Meta.Lib" Version="2.0.1" />
<PackageReference Include="Meta.Lib" />
paket add Meta.Lib --version 2.0.1
#r "nuget: Meta.Lib, 2.0.1"
#:package Meta.Lib@2.0.1
#addin nuget:?package=Meta.Lib&version=2.0.1
#tool nuget:?package=Meta.Lib&version=2.0.1
Meta.Lib
MetaPubSub is an implementation of the publish/subscribe pattern - when the publisher and subscriber know nothing of each other but can exchange messages. It's fast, lightweight and beside basic functionality has some cool features:
- interprocess communication - messages can be sent between different processes and computers
- awaitable methods, for example, you can await
Publishand wait until all subscribers have finished processing the message - at least once delivery check - you can opt in to have an exception if no one subscribed to your message
- message filtering - you can define a predicate to subscribe only those messages you want to process
- timeout to wait for a subscriber - your message can be queued and wait until someone subscribed and processed it
- scheduling a message - your message can be queued and published after a time delay
- request-response pattern - send a message and wait for the response as a single awaitable method, without need to
Subscribe/Unsubscribeto the response message - cancellation token support - you can cancel scheduling or waiting for the message
- exceptions handling - all exceptions raised when a message processing by subscribers can be caught by the publisher as an
AggregateException
MetaPipeServer and MetaPipeConnection are used to simplify inter-process communication using named pipes. The module utilizes NamedPipeServerStream and NamedPipeClientStream for message transmission. System.Text.Json is used for object serialization before sending. The main features of the module include:
- automatic connection recovery in case of disconnection
- transmission of strings, byte arrays, and arbitrary objects
- sending an arbitrary object and waiting for the response in a single method call.
PubSubPipe extends the capabilities of the MetaPubSub module by adding the ability to exchange messages between processes or computers.
StateMachine is a simple and easy to use state machine implementation. It is thread-safe and can be used in a concurrent environment. See the implementation of the MetaPipeConnection class for an example of usage.
NuGet packages
To install the Meta.Lib run the following command:
PM> Install-Package Meta.Lib
How to use
FAQ
Changelog
Ver. 2.0.0
Note: this version has breaking changes. See migration guide.
- MetaPubSub has been separated into three modules - local
PubSub,Pipe, andPubSubPipe.PubSub– is a local publisher/subscriber implementation.Pipe– is a wrapper onNamedPipeServerStreamandNamedPipeClientStreamto simplify interprocess communication.PubSubPipe– is a wrapper on bothPubSubandPipewhich adds interprocess communication ability forPubSubviaPipe. - Added
ConcurrentStateMachine. - Custom
Loggerimplementation replaced withILoggerfrom theMicrosoft.Extensions.Loggingnamespace. - Removed
IPubSubMessageinterface. You don't need to derive your message classes from this interface anymore. - Performance improvements.
Ver. 1.1.3
Note: this version has breaking changes.
IPubSubMessage.Timeoutrenamed toWaitForSubscriberTimeout.- Added
IPubSubMessage.ResponseTimeout- Time interval during which the response message must be received otherwise theTimeoutExceptionwill be thrown. Used inIMetaPubSub.Process()andIMetaPubSub.ProcessOnServer(). - Removed parameter
millisecondsTimeoutfromIMetaPubSub.Process()andIMetaPubSub.ProcessOnServer(). UseIPubSubMessage.ResponseTimeoutinstead. - Fixed bug: timeout in
IMetaPubSub.Process()andIMetaPubSub.ProcessOnServer()always use it's default value of 5 sec.
Ver. 1.1.2
- Added
TryConnectToServer&TrySubscribeOnServer. - Added a match predicate to
SubscribeOnServermethod. - Added
Connected/Disconnectedbuilt-in messages. - Added a delegate method to create a pipe with non-default parameters.
Ver. 1.1.1
- Interprocess communication implemented.
| 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.
- MetaPubSub has been separated into three modules - local `PubSub`, `Pipe`, and `PubSubPipe`. `PubSub` – is a local publisher/subscriber implementation. `Pipe` – is a wrapper on `NamedPipeServerStream` and `NamedPipeClientStream` to simplify interprocess communication. `PubSubPipe` – is a wrapper on both `PubSub` and `Pipe` which adds interprocess communication ability for `PubSub` via `Pipe`.
- Added `ConcurrentStateMachine`.
- Custom `Logger` implementation replaced with `ILogger` from the `Microsoft.Extensions.Logging` namespace.
- Removed `IPubSubMessage` interface. You don't need to derive your message classes from this interface anymore.
- Performance improvements.