Pamoja.Loopback
0.1.17
dotnet add package Pamoja.Loopback --version 0.1.17
NuGet\Install-Package Pamoja.Loopback -Version 0.1.17
<PackageReference Include="Pamoja.Loopback" Version="0.1.17" />
<PackageVersion Include="Pamoja.Loopback" Version="0.1.17" />
<PackageReference Include="Pamoja.Loopback" />
paket add Pamoja.Loopback --version 0.1.17
#r "nuget: Pamoja.Loopback, 0.1.17"
#:package Pamoja.Loopback@0.1.17
#addin nuget:?package=Pamoja.Loopback&version=0.1.17
#tool nuget:?package=Pamoja.Loopback&version=0.1.17
Pamoja.Loopback
An in-process transport with topic matching and a fault injector, for testing with no broker. One capability of pamoja, one memory-safe Rust core with bindings for TypeScript, Python, and C#.
Install
dotnet add package Pamoja.Loopback
using Pamoja.Loopback;
This pulls in Pamoja.Native, the compiled engine, and Pamoja.Core. dotnet add package Pamoja is the whole framework in one package.
Example
The guide project's example, spliced here as it ran in CI.
From bindings/dotnet/samples/Pamoja.Guides/LoopbackGuide.cs:
// One broker and two links off it, all in this process. Nothing binds a port and
// nothing has to be running for the traffic below to flow, which is what makes
// this the link to develop a node against before it has a real one.
using var broker = new LoopbackBroker();
using LoopbackTransport publisher = broker.Link();
using LoopbackTransport subscriber = broker.Link();
await publisher.ConnectAsync();
await subscriber.ConnectAsync();
// A `+` stands for exactly one level, so this takes the mixer's temperature but
// not the raw reading a level below it.
await subscriber.SubscribeAsync("line/+/temp");
await publisher.SendAsync("line/mixer/temp/raw", "2150"u8.ToArray());
await publisher.SendAsync("line/mixer/temp", "21.5"u8.ToArray());
TransportMessage message = (await subscriber.ReceiveAsync())!;
Console.WriteLine(
$"line/+/temp took {System.Text.Encoding.UTF8.GetString(message.Payload)}"
+ $" from {message.Topic}");
// A `#` covers every level that remains, so a second link takes the whole subtree,
// including the reading the single-level filter passed over.
using LoopbackTransport watcher = broker.Link();
await watcher.ConnectAsync();
await watcher.SubscribeAsync("line/#");
await publisher.SendAsync("line/mixer/temp/raw", "2150"u8.ToArray());
TransportMessage deep = (await watcher.ReceiveAsync())!;
Console.WriteLine(
$"line/# took {System.Text.Encoding.UTF8.GetString(deep.Payload)}"
+ $" from {deep.Topic}");
// A link that has been disconnected reports the failure instead of dropping the
// reading, which is the case a test wants to reach without unplugging anything.
await publisher.DisconnectAsync();
try
{
await publisher.SendAsync("line/mixer/temp", "21.6"u8.ToArray());
Console.WriteLine("a disconnected link took a reading, which should never happen");
}
catch (PamojaException error)
{
Console.WriteLine($"disconnected refused the reading: {error.Message}");
}
The same capability in every language
| Language | Package | Reference |
|---|---|---|
| Rust | pamoja-loopback |
reference, docs.rs, install |
| TypeScript | @pamoja/loopback |
reference, install |
| Python | pamoja-loopback |
reference, install |
| C# | Pamoja.Loopback |
reference, install |
Documentation
Pamoja.Loopbackreference, every type in this namespace.- The Loopback guide, with the same example in Rust, TypeScript, and Python.
- Every capability, and the install page.
License
MIT
| Product | Versions 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. |
-
net8.0
- Pamoja.Core (>= 0.1.17)
- Pamoja.Native (>= 0.1.17)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Pamoja.Loopback:
| Package | Downloads |
|---|---|
|
Pamoja
The whole pamoja framework in one package: every capability of one memory-safe Rust core, behind an idiomatic C# facade, for IoT, robotics, and drones. |
|
|
Pamoja.Transports
Transports and testing: Reaching the network when no single link always works, and testing all of it with nothing plugged in. |
GitHub repositories
This package is not used by any popular GitHub repositories.