Skip to content

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

The RPC service name this dispatcher handles.

string ServiceName { get; }

string

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

Section titled “ 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 DotBoxD.Services.Protocol.ServiceHandle.

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

method string

payload ReadOnlyMemory<byte>

serializer ISerializer

registry IInstanceRegistry

output IBufferWriter<byte>

ct CancellationToken

Task

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

Section titled “ 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)

method string

payload ReadOnlyMemory<byte>

serializer ISerializer

registry IInstanceRegistry

output IBufferWriter<byte>

streaming IRpcStreamingContext

ct CancellationToken

Task

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

Section titled “ DispatchOnInstanceAsync(string, string, ReadOnlyMemory<byte>, ISerializer, IInstanceRegistry, IBufferWriter<byte>, CancellationToken)”

Dispatches a call to a specific server-side instance previously registered with DotBoxD.Services.Server.IInstanceRegistry.Register(System.String,System.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)

instanceId string

method string

payload ReadOnlyMemory<byte>

serializer ISerializer

registry IInstanceRegistry

output IBufferWriter<byte>

ct CancellationToken

Task

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

Section titled “ 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)

instanceId string

method string

payload ReadOnlyMemory<byte>

serializer ISerializer

registry IInstanceRegistry

output IBufferWriter<byte>

streaming IRpcStreamingContext

ct CancellationToken

Task