Table of Contents

Interface IServiceDispatcher

Namespace
DotBoxD.Services.Server
Assembly
DotBoxD.Services.dll

Interface for generated service dispatchers that route incoming requests to the appropriate service method. Root-service dispatchers use DispatchAsync; sub-service dispatchers also implement DispatchOnInstanceAsync to route calls to a particular registered instance.

public interface IServiceDispatcher

Properties

ServiceName

The RPC service name this dispatcher handles.

string ServiceName { get; }

Property Value

string

Methods

DispatchAsync(string, ReadOnlyMemory<byte>, ISerializer, IInstanceRegistry, IBufferWriter<byte>, IRpcStreamingContext, CancellationToken)

Dispatches a singleton-service request with access to streamed arguments and streamed responses. Existing dispatchers fall back to the non-streaming overload.

Task DispatchAsync(string method, ReadOnlyMemory<byte> payload, ISerializer serializer, IInstanceRegistry registry, IBufferWriter<byte> output, IRpcStreamingContext streaming, CancellationToken ct = default)

Parameters

method string
payload ReadOnlyMemory<byte>
serializer ISerializer
registry IInstanceRegistry
output IBufferWriter<byte>
streaming IRpcStreamingContext
ct CancellationToken

Returns

Task

DispatchAsync(string, ReadOnlyMemory<byte>, ISerializer, IInstanceRegistry, IBufferWriter<byte>, CancellationToken)

Dispatches a singleton-service request to the appropriate method and serializes the result into output. Writing straight into the caller's buffer lets the server append the result behind the response envelope without an intermediate buffer and copy; a void/Task-returning method writes nothing. registry is the per-connection instance registry — dispatchers ignore it unless the method returns a sub-service interface, in which case they register the returned instance and serialize a ServiceHandle.

Task DispatchAsync(string method, ReadOnlyMemory<byte> payload, ISerializer serializer, IInstanceRegistry registry, IBufferWriter<byte> output, CancellationToken ct = default)

Parameters

method string
payload ReadOnlyMemory<byte>
serializer ISerializer
registry IInstanceRegistry
output IBufferWriter<byte>
ct CancellationToken

Returns

Task

DispatchOnInstanceAsync(string, string, ReadOnlyMemory<byte>, ISerializer, IInstanceRegistry, IBufferWriter<byte>, IRpcStreamingContext, CancellationToken)

Dispatches an instance-scoped request with access to streamed arguments and streamed responses. Existing dispatchers fall back to the non-streaming overload.

Task DispatchOnInstanceAsync(string instanceId, string method, ReadOnlyMemory<byte> payload, ISerializer serializer, IInstanceRegistry registry, IBufferWriter<byte> output, IRpcStreamingContext streaming, CancellationToken ct = default)

Parameters

instanceId string
method string
payload ReadOnlyMemory<byte>
serializer ISerializer
registry IInstanceRegistry
output IBufferWriter<byte>
streaming IRpcStreamingContext
ct CancellationToken

Returns

Task

DispatchOnInstanceAsync(string, string, ReadOnlyMemory<byte>, ISerializer, IInstanceRegistry, IBufferWriter<byte>, CancellationToken)

Dispatches a call to a specific server-side instance previously registered with Register(string, object), serializing the result into output. Default implementation throws — the generator only emits an override for service dispatchers that may be reached as sub-services.

Task DispatchOnInstanceAsync(string instanceId, string method, ReadOnlyMemory<byte> payload, ISerializer serializer, IInstanceRegistry registry, IBufferWriter<byte> output, CancellationToken ct = default)

Parameters

instanceId string
method string
payload ReadOnlyMemory<byte>
serializer ISerializer
registry IInstanceRegistry
output IBufferWriter<byte>
ct CancellationToken

Returns

Task