Interface IServiceDispatcher
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
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
methodstringpayloadReadOnlyMemory<byte>serializerISerializerregistryIInstanceRegistryoutputIBufferWriter<byte>streamingIRpcStreamingContextctCancellationToken
Returns
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
methodstringpayloadReadOnlyMemory<byte>serializerISerializerregistryIInstanceRegistryoutputIBufferWriter<byte>ctCancellationToken
Returns
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
instanceIdstringmethodstringpayloadReadOnlyMemory<byte>serializerISerializerregistryIInstanceRegistryoutputIBufferWriter<byte>streamingIRpcStreamingContextctCancellationToken
Returns
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
instanceIdstringmethodstringpayloadReadOnlyMemory<byte>serializerISerializerregistryIInstanceRegistryoutputIBufferWriter<byte>ctCancellationToken