LiteWare.Remoting.Core
0.2.0
dotnet add package LiteWare.Remoting.Core --version 0.2.0
NuGet\Install-Package LiteWare.Remoting.Core -Version 0.2.0
<PackageReference Include="LiteWare.Remoting.Core" Version="0.2.0" />
paket add LiteWare.Remoting.Core --version 0.2.0
#r "nuget: LiteWare.Remoting.Core, 0.2.0"
// Install LiteWare.Remoting.Core as a Cake Addin #addin nuget:?package=LiteWare.Remoting.Core&version=0.2.0 // Install LiteWare.Remoting.Core as a Cake Tool #tool nuget:?package=LiteWare.Remoting.Core&version=0.2.0
LiteWare.Remoting.Core for .NET
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:
The transport (a.k.a
RemoteTransport
)
It is responsible for serialization and sending/receiving of payloads over a transport/network.The service mediator
It is responsible for payload marshalling and its distribution across the other sub-systems.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.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 (RemoteTransport
, IMessageSerializer
and RemoteTransportBuilder
)
The transport is represented by the abstract RemoteTransport
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 RemoteTransport
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 RemoteTransport
class should prevent direct initialization through constructors.
A derivation of the RemoteTransportBuilder
class should instead be used to build new instances as this allows for a proper configuration of the transport 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:
It can be configured to handle incoming remote calls
This will automatically create and send responses when needed. This process can be configured to be synchronous or asynchronous.It can also be configured to dispatch remote calls, allowing the following code to 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
Or it can be configured to do both at the same time.
Configuring a RemoteService
is done using RemoteServiceBuilder
or using fluent configuration.
Fluent configuration
New instances of RemoteService
can be created using Remote.ConfigureService()
:
RemoteService remoteService = Remote
.ConfigureService()
.WithRemoteCallDispatcher() // Configure the remote service to dispatch calls or requests
.HavingRequestTimeout(10 * 1000) // with a request timeout of 10sec.
.WithRemoteCallHandler() // Configure the remote serviec to handle remote calls or requests
.UsingCommandInvoker(commandInvoker) // using 'commandInvoker' to handle the received calls or requests
.Synchronously() // while doing so synchronously.
.OnTransport(remoteTransportBuilder) // Configure the remote service to use the transport built from 'remoteTransportBuilder'
.WithMarshaller(simpleMarshaller) // Configure the remote service to use a simple marshaller
.Create();
Product | Versions 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. |
-
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.