![]() |
VOOZH | about |
dotnet add package NexusRpc --version 0.3.0
NuGet\Install-Package NexusRpc -Version 0.3.0
<PackageReference Include="NexusRpc" Version="0.3.0" />
<PackageVersion Include="NexusRpc" Version="0.3.0" />Directory.Packages.props
<PackageReference Include="NexusRpc" />Project file
paket add NexusRpc --version 0.3.0
#r "nuget: NexusRpc, 0.3.0"
#:package NexusRpc@0.3.0
#addin nuget:?package=NexusRpc&version=0.3.0Install as a Cake Addin
#tool nuget:?package=NexusRpc&version=0.3.0Install as a Cake Tool
⚠️ This SDK is currently at an experimental release stage. Backwards-incompatible changes are anticipated until a stable release is announced. ⚠️
.NET SDK for working with Nexus RPC. See API documentation.
Nexus is a synchronous RPC protocol. Arbitrary length operations are modelled on top of a set of pre-defined synchronous RPCs.
A Nexus caller calls a handler. The handler may respond inline or return a reference for a future, asynchronous operation. The caller can cancel an asynchronous operation, check for its outcome, or fetch its current state. The caller can also specify a callback URL, which the handler uses to asynchronously deliver the result of an operation when it is ready.
Add the NexusRpc package from NuGet. For example, using the dotnet CLI:
dotnet add package NexusRpc
The .NET SDK supports .NET Framework >= 4.6.2, .NET Core >= 3.1 (so includes .NET 5+), and .NET Standard >= 2.0.
The SDK currently supports defining Nexus services and implementing handlers for them.
Define a Nexus service with an interface containing a [NexusService] attribute. Each operation is an interface method
accepting 0 or 1 parameters that has the [NexusOperation] attribute. For example:
using NexusRpc;
[NexusService]
public interface IGreetingService
{
[NexusOperation]
string SayHello1(string name);
[NexusOperation]
string SayHello2(string name);
}
This can be used by both Nexus callers and Nexus handler implementers. Although not yet implemented in this SDK, clients can leverage this service for type-safe Nexus invocations. Handlers can be implemented that conform to this service as seen in the next section.
Nexus service handlers are classes that have the NexusServiceHandler attribute and reference the service interface.
Nexus operation handlers are returned via parameterless methods that are effectively "operation handler factories" and
are named the same as the operation. Some shortcuts exist for making operations. For example:
using NexusRpc.Handlers;
namespace NexusRpc.Tests.Example;
[NexusServiceHandler(typeof(IGreetingService))]
public class GreetingService(IApiClient ApiClient)
{
// Can be static
[NexusOperationHandler]
public static IOperationHandler<string, string> SayHello1() =>
// Simple, synchronous operations can use a helper for a lambda
OperationHandler.Sync<string, string>((ctx, name) => $"Hello, {name}!");
[NexusOperationHandler]
public IOperationHandler<string, string> SayHello2() =>
// Advanced, potentially asynchronous operations
new SayHello2Handler(ApiClient);
public class SayHello2Handler(IApiClient ApiClient) : IOperationHandler<string, string>
{
public Task<OperationStartResult<string>> StartAsync(
OperationStartContext context, string name) =>
throw new NotImplementedException("Excluded for brevity");
public Task CancelAsync(OperationCancelContext context) =>
throw new NotImplementedException("Excluded for brevity");
}
}
Prerequisites:
With all prerequisites in place, run:
dotnet build
Or for release:
dotnet build --configuration Release
This project uses StyleCop analyzers with some overrides in .editorconfig. To format, run:
dotnet format
Can also run with --verify-no-changes to ensure it is formatted.
Run:
dotnet test
Can add options like:
--logger "console;verbosity=detailed" to show logs--filter "FullyQualifiedName=NexusRpc.Tests.ServiceDefinitionTests.FromType_NonInterface_Bad" to run a
specific testTo help show full stdout/stderr, this is also available as an in-proc test program. Run:
dotnet run --project tests/NexusRpc.Tests
Extra args can be added after --, e.g. -- -verbose would show verbose logs and -- --help would show other
options. If the arguments are anything but --help, the current assembly is prepended to the args before sending to the
xUnit runner.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 is compatible. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 1 NuGet packages that depend on NexusRpc:
| Package | Downloads |
|---|---|
|
Temporalio
Temporal SDK for .NET |
Showing the top 2 popular GitHub repositories that depend on NexusRpc:
| Repository | Stars |
|---|---|
|
temporalio/sdk-dotnet
Temporal .NET SDK
|
|
|
temporalio/samples-dotnet
Samples for working with the Temporal .NET SDK
|