LiteWare.Remoting.Core 0.1.0

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

// Install LiteWare.Remoting.Core as a Cake Tool
#tool nuget:?package=LiteWare.Remoting.Core&version=0.1.0                

LiteWare.Remoting.Core for .NET

Nuget License

LiteWare's core implementation for distributed systems. It provides the barebone communication framework that handles the flow of data between connected distributed systems. Built with flexibility and extensibility in mind, the core framework was designed to provide many abstractions to allow customizations in implementing libraries. For instance, you can create a custom transport (HTTP, IPC or whatever protocol) to transport payload between remote services.

Infrastructure overview

The framework uses the RemoteService class for all communications. It is the main service of the framework and is broken down into 4 sub-systems:

RemoteServie overview

  1. The transport (a.k.a RemoteNetwork)
    It is responsible for serialization and sending/receiving of payloads over a network.

  2. The service mediator
    It is responsible for payload marshalling and its distribution across the other sub-systems.

  3. The optionally configured Remote call Dispatcher (a.k.a RemoteCallDispatcher)
    It is responsible for invoking remote calls on other remote services.
    This sub-system is optional and can be omitted during configuration. This will prevent the service from invoking remote calls.

  4. The optionally configured Remote call Handler (a.k.a RemoteCallHandler)
    It is responsible for the handling of incoming remote calls and to create response to these incoming calls.
    This sub-system is optional and can be omitted during configuration. This will prevent the service from handling remote calls.

Implementing the core library

Any library implementing LiteWare.Remoting.Core should implement the following:

1. Custom marshaller (IMarshaller)

The RemoteService requires an implementation of IMarshaller to convert remote calls and requests to and from an array of bytes.

2. Custom transport (RemoteNetwork, IMessageSerializer and RemoteNetworkBuilder)

The transport is represented by the abstract RemoteNetwork class and is responsible for the exchange of payloads between remote services. This class should be extended and specialized to use a specific communication protocol.

The RemoteNetwork is also responsible for the serialization and deserialization of payloads and thus, requires that an implementation of IMessageSerializer is provided during its construction. IMessageSerializer is different from IMarshaller. The latter serializes remote objects (RemoteCall and RemoteResponse) while the former serializes framed payloads (Message) containing remote objects.

Implementations of the RemoteNetwork class should prevent direct initialization through constructors. A derivation of the RemoteNetworkBuilder class should instead be used to build new instances as this allows for a proper configuration of the network in a remote service.

3. Custom command invoking

An implementation of ICommandInvoker must be provided if a RemoteService is configured to handle incoming remote calls. The ICommandInvoker is tasked with interpreting the remote call to generate a response.

Using RemoteService

RemoteService is the main class that allows remoting on distributed systems. It can be configured in 3 ways:

  1. It can be configured to handle incoming remote calls
    This will automatically create and send a response when needed and can be done synchronously or asynchronously.

  2. It can also be configured to dispatch remote calls. Once done, the following code can be executed:

    remoteService.Call("IncrementCounter"); // Make a one-way call to a remote service
    int? count = (int?)remoteService.Request("Count"); // Make a request and synchronously await for a response
    object? value = await remoteService.RequestAsync("CalculateSum", 1, 2, 3); // Make a request and asynchronously await for a response
    
  3. Or it can be configured to do both at the same time.

Configuring a RemoteService is done using fluent language as shown below:

Fluent configuration

New instances of RemoteService can be created using RemoteService.Configure():

RemoteService remoteService = RemoteService
    .Configure()
    .WithMarshaller(simpleMarshaller)
    .ForNetwork(httpRemoteNetworkBuilder)
    .DisableCallDispatching()
    .EnableCallHandling()
        .UsingCommandInvoker(commandInvoker)
        .Asynchronously()
    .Create();
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

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
0.2.0 472 3/27/2022
0.1.1 424 2/24/2022
0.1.0 405 2/24/2022

Initial code commit