StellaOps.Router.Common

Shared Router types: frames, endpoint descriptors, options and the transport and plugin contracts used by microservices, gateways and transports.

library
Component
Router
Licence
Apache-2.0
Target framework
net10.0
Latest release
1.0.1-20261117T070237Z

Install

dotnet add package StellaOps.Router.Common --version 1.0.1-20261117T070237Z

Namespaces

NamespaceTypes
StellaOps.Router.Common2
StellaOps.Router.Common.Abstractions9
StellaOps.Router.Common.Enums3
StellaOps.Router.Common.Frames18
StellaOps.Router.Common.Identity3
StellaOps.Router.Common.Models24
StellaOps.Router.Common.Plugins5

namespace StellaOps.Router.Common

TypeKindDescription
PathMatcherclassMatches request paths against route templates.
PathTemplateSpecificityclassRanks route templates that all match the same request path, from most to least specific.

class PathMatcher

public sealed class PathMatcher

Matches request paths against route templates.

Members

MemberKindSummary
PathMatcher(string, bool)constructorInitializes a new instance of the PathMatcherclass.
TemplatepropertyGets the route template.
IsMatch(string)methodChecks if a path matches the template.
TryMatch(string, out Dictionary<string, string>)methodTries to match a path against the template.

constructor PathMatcher(string, bool) #

public PathMatcher(string template, bool caseInsensitive = true)

Initializes a new instance of the PathMatcherclass.

Parameters

  • template: The route template (e.g., “/api/users/{id}”). A trailing slash of the template, like one of the request path, does not take part in matching; PathMatcher.Templatekeeps it.
  • caseInsensitive: Whether matching should be case-insensitive.

property Template #

public string Template { get; }

Gets the route template.

method IsMatch(string) #

public bool IsMatch(string path)

Checks if a path matches the template.

Parameters

  • path: The request path.

Returns

True if the path matches.

method TryMatch(string, out Dictionary<string, string>) #

public bool TryMatch(string path, out Dictionary<string, string> parameters)

Tries to match a path against the template.

Parameters

  • path: The request path.
  • parameters: The extracted path parameters if matched.

Returns

True if the path matches.

class PathTemplateSpecificity

public static class PathTemplateSpecificity

Ranks route templates that all match the same request path, from most to least specific.

Remarks

Raw template length is not a specificity signal: a parameter placeholder is usually longer than the literal it competes with, so ordering by length alone lets an unconstrained /prefix/{id} out-rank a sibling literal /prefix/export — and where the two are published by DIFFERENT services, the loser’s surface becomes unreachable through the gateway with nothing in the route table to show for it.

A route constraint (for example {artifactDigest:digest}) removes the ambiguity at the source instead of ranking it at the gateway. The ordering applies to every template pair without such a constraint, so it is applied unconditionally rather than behind a flag.

Members

MemberKindSummary
MostSpecificFirstpropertyOrders templates most-specific-first, for use as an ascending sort comparer.
Compare(string, string)methodCompares two templates, returning a negative value when left is the more specific of the two.
LiteralSegmentCount(string)methodCounts the segments of template that contain no parameter placeholder.
ParameterSegmentCount(string)methodCounts the segments of template that contain a parameter placeholder.

property MostSpecificFirst #

public static IComparer<string> MostSpecificFirst { get; }

Orders templates most-specific-first, for use as an ascending sort comparer.

method Compare(string, string) #

public static int Compare(string? left, string? right)

Compares two templates, returning a negative value when left is the more specific of the two.

method LiteralSegmentCount(string) #

public static int LiteralSegmentCount(string? template)

Counts the segments of template that contain no parameter placeholder.

method ParameterSegmentCount(string) #

public static int ParameterSegmentCount(string? template)

Counts the segments of template that contain a parameter placeholder.

namespace StellaOps.Router.Common.Abstractions

TypeKindDescription
IGatewayConnectionTransportServerinterfaceGateway-side contract for connection-oriented Router transport servers.
IGatewayMessagingTransportServerinterfaceGateway-side contract for queue-backed messaging transport servers.
IGlobalRoutingStateinterfaceProvides global routing state derived from all live connections.
IMicroserviceTransportinterfaceRepresents a transport connection from a microservice to the gateway.
IRegionProviderinterfaceProvides region information for routing decisions.
IRoutingPlugininterfaceProvides extensibility for routing decisions.
ITransportClientinterfaceRepresents a transport client for sending requests to microservices.
ITransportServerinterfaceRepresents a transport server that accepts connections from microservices.
TransportStreamingDispatchclassThe streaming dispatch of the transports whose microservice side answers each request with one response frame.

interface IGatewayConnectionTransportServer

public interface IGatewayConnectionTransportServer : ITransportServer

Gateway-side contract for connection-oriented Router transport servers.

Members

MemberKindSummary
TransportTypepropertyThe transport this server provides.
OnDisconnectioneventRaised when a connection closes, with its identifier.
OnFrameeventRaised for each frame a connection receives, with the connection identifier.
CloseConnection(string)methodCloses a connection.
SendFrameAsync(string, Frame, CancellationToken)methodSends a frame on a connection.

property TransportType #

TransportType TransportType { get; }

The transport this server provides.

event OnDisconnection #

event Action<string>? OnDisconnection

Raised when a connection closes, with its identifier.

event OnFrame #

event Action<string, Frame>? OnFrame

Raised for each frame a connection receives, with the connection identifier.

method CloseConnection(string) #

bool CloseConnection(string connectionId)

Closes a connection.

Parameters

  • connectionId: The connection identifier.

Returns

true when the connection existed and was closed.

method SendFrameAsync(string, Frame, CancellationToken) #

Task SendFrameAsync(string connectionId, Frame frame, CancellationToken cancellationToken = default)

Sends a frame on a connection.

Parameters

  • connectionId: The connection identifier.
  • frame: The frame to send.
  • cancellationToken: Cancels the send.

Returns

A task that completes when the frame is sent.

interface IGatewayMessagingTransportServer

public interface IGatewayMessagingTransportServer : ITransportServer

Gateway-side contract for queue-backed messaging transport servers.

Members

MemberKindSummary
OnConnectionClosedeventRaised when a microservice connection closes, with its identifier.
OnEndpointsUpdatedeventRaised when a microservice replays or updates its endpoints.
OnHeartbeatReceivedeventRaised for each heartbeat of a microservice.
OnHelloReceivedeventRaised when a microservice announces itself and its endpoints (a HELLO).
OnResponseReceivedeventRaised for each response frame a microservice sends.
SendToMicroserviceAsync(string, Frame, CancellationToken)methodSends a frame to the microservice of a connection.

event OnConnectionClosed #

event Func<string, Task>? OnConnectionClosed

Raised when a microservice connection closes, with its identifier.

event OnEndpointsUpdated #

event Func<ConnectionState, EndpointsUpdatePayload, Task>? OnEndpointsUpdated

Raised when a microservice replays or updates its endpoints.

event OnHeartbeatReceived #

event Func<ConnectionState, HeartbeatPayload, Task>? OnHeartbeatReceived

Raised for each heartbeat of a microservice.

event OnHelloReceived #

event Func<ConnectionState, HelloPayload, Task>? OnHelloReceived

Raised when a microservice announces itself and its endpoints (a HELLO).

event OnResponseReceived #

event Func<ConnectionState, Frame, Task>? OnResponseReceived

Raised for each response frame a microservice sends.

method SendToMicroserviceAsync(string, Frame, CancellationToken) #

ValueTask SendToMicroserviceAsync(string connectionId, Frame frame, CancellationToken cancellationToken)

Sends a frame to the microservice of a connection.

Parameters

  • connectionId: The connection identifier.
  • frame: The frame to send.
  • cancellationToken: Cancels the send.

Returns

A task that completes when the frame is queued.

interface IGlobalRoutingState

public interface IGlobalRoutingState

Provides global routing state derived from all live connections.

Members

MemberKindSummary
AddConnection(ConnectionState)methodAdds a connection to the routing state.
GetAllConnections()methodGets all active connections.
GetConnection(string)methodGets a connection by its ID.
GetConnectionsFor(EndpointDescriptor)methodFinds instances of an already-resolved canonical endpoint without matching paths again.
GetConnectionsFor(string, string, string, string)methodGets all connections that can handle the specified endpoint.
MatchesEndpoint(EndpointDescriptor, string)methodMatches a registered endpoint using its retained route matcher.
RemoveConnection(string)methodRemoves a connection from the routing state.
ResolveEndpoint(string, string)methodResolves an HTTP request to an endpoint descriptor.
UpdateConnection(string, Action<ConnectionState>)methodUpdates an existing connection’s state.

method AddConnection(ConnectionState) #

void AddConnection(ConnectionState connection)

Adds a connection to the routing state.

Parameters

  • connection: The connection state to add.

method GetAllConnections() #

IReadOnlyList<ConnectionState> GetAllConnections()

Gets all active connections.

Returns

All active connections.

method GetConnection(string) #

ConnectionState? GetConnection(string connectionId)

Gets a connection by its ID.

Parameters

  • connectionId: The connection ID.

Returns

The connection state, or null if not found.

method GetConnectionsFor(EndpointDescriptor) #

IReadOnlyList<ConnectionState> GetConnectionsFor(EndpointDescriptor endpoint)

Finds instances of an already-resolved canonical endpoint without matching paths again.

method GetConnectionsFor(string, string, string, string) #

IReadOnlyList<ConnectionState> GetConnectionsFor(string serviceName, string version, string method, string path)

Gets all connections that can handle the specified endpoint.

Parameters

  • serviceName: The service name.
  • version: The service version.
  • method: The HTTP method.
  • path: The request path.

Returns

The available connection states.

method MatchesEndpoint(EndpointDescriptor, string) #

bool MatchesEndpoint(EndpointDescriptor endpoint, string path)

Matches a registered endpoint using its retained route matcher.

method RemoveConnection(string) #

void RemoveConnection(string connectionId)

Removes a connection from the routing state.

Parameters

  • connectionId: The connection ID to remove.

method ResolveEndpoint(string, string) #

EndpointDescriptor? ResolveEndpoint(string method, string path)

Resolves an HTTP request to an endpoint descriptor.

Parameters

  • method: The HTTP method.
  • path: The request path.

Returns

The endpoint descriptor, or null if not found.

method UpdateConnection(string, Action<ConnectionState>) #

void UpdateConnection(string connectionId, Action<ConnectionState> update)

Updates an existing connection’s state.

Parameters

  • connectionId: The connection ID to update.
  • update: The update action to apply.

interface IMicroserviceTransport

public interface IMicroserviceTransport

Represents a transport connection from a microservice to the gateway. This interface is used by the Microservice SDK to communicate with the router.

Members

MemberKindSummary
OnCancelReceivedeventEvent raised when a CANCEL frame is received from the gateway.
OnRequestReceivedeventEvent raised when a REQUEST frame is received from the gateway.
OnResyncRequestedeventEvent raised when the router explicitly requests a fresh endpoint metadata replay.
TransportDiedeventRaised when the transport connection is permanently lost and cannot recover.
ConnectAsync(InstanceDescriptor, IReadOnlyList<EndpointDescriptor>, CancellationToken)methodConnects to the router and registers the microservice.
ConnectAsync(InstanceDescriptor, IReadOnlyList<EndpointDescriptor>, IReadOnlyDictionary<string, SchemaDefinition>, ServiceOpenApiInfo, CancellationToken)methodConnects to the router and registers the microservice, including schemas and OpenAPI metadata.
DisconnectAsync()methodDisconnects from the router.
SendEndpointsUpdateAsync(IReadOnlyList<EndpointDescriptor>, IReadOnlyDictionary<string, SchemaDefinition>, ServiceOpenApiInfo, CancellationToken)methodSends the current endpoint/schema/OpenAPI metadata after the router explicitly requests a replay.
SendGoodbyeAsync(CancellationToken)methodSends a best-effort Goodbye control frame before shutdown.
SendHeartbeatAsync(HeartbeatPayload, CancellationToken)methodSends a heartbeat to the router.

event OnCancelReceived #

event Func<Guid, string?, Task>? OnCancelReceived

Event raised when a CANCEL frame is received from the gateway.

event OnRequestReceived #

event Func<Frame, CancellationToken, Task<Frame>>? OnRequestReceived

Event raised when a REQUEST frame is received from the gateway.

event OnResyncRequested #

event Func<RegistrationResyncRequestPayload, CancellationToken, Task>? OnResyncRequested

Event raised when the router explicitly requests a fresh endpoint metadata replay.

event TransportDied #

event Action? TransportDied

Raised when the transport connection is permanently lost and cannot recover. Consumers should reconnect by calling IMicroserviceTransport.ConnectAsync(InstanceDescriptor, IReadOnlyList<EndpointDescriptor>, CancellationToken)again.

method ConnectAsync(InstanceDescriptor, IReadOnlyList<EndpointDescriptor>, CancellationToken) #

Task ConnectAsync(InstanceDescriptor instance, IReadOnlyList<EndpointDescriptor> endpoints, CancellationToken cancellationToken)

Connects to the router and registers the microservice.

Parameters

  • instance: The instance descriptor.
  • endpoints: The endpoints to register.
  • cancellationToken: Cancellation token.

method ConnectAsync(InstanceDescriptor, IReadOnlyList<EndpointDescriptor>, IReadOnlyDictionary<string, SchemaDefinition>, ServiceOpenApiInfo, CancellationToken) #

Task ConnectAsync(InstanceDescriptor instance, IReadOnlyList<EndpointDescriptor> endpoints, IReadOnlyDictionary<string, SchemaDefinition>? schemas, ServiceOpenApiInfo? openApiInfo, CancellationToken cancellationToken)

Connects to the router and registers the microservice, including schemas and OpenAPI metadata.

Parameters

  • instance: The instance descriptor.
  • endpoints: The endpoints to register.
  • schemas: Optional schema definitions keyed by schema id.
  • openApiInfo: Optional OpenAPI service metadata.
  • cancellationToken: Cancellation token.

method DisconnectAsync() #

Task DisconnectAsync()

Disconnects from the router.

method SendEndpointsUpdateAsync(IReadOnlyList<EndpointDescriptor>, IReadOnlyDictionary<string, SchemaDefinition>, ServiceOpenApiInfo, CancellationToken) #

Task SendEndpointsUpdateAsync(IReadOnlyList<EndpointDescriptor> endpoints, IReadOnlyDictionary<string, SchemaDefinition>? schemas, ServiceOpenApiInfo? openApiInfo, CancellationToken cancellationToken)

Sends the current endpoint/schema/OpenAPI metadata after the router explicitly requests a replay.

method SendGoodbyeAsync(CancellationToken) #

Task SendGoodbyeAsync(CancellationToken cancellationToken)

Sends a best-effort Goodbye control frame before shutdown. Transports that do not maintain a live microservice connection may no-op.

Parameters

  • cancellationToken: Cancellation token.

method SendHeartbeatAsync(HeartbeatPayload, CancellationToken) #

Task SendHeartbeatAsync(HeartbeatPayload heartbeat, CancellationToken cancellationToken)

Sends a heartbeat to the router.

Parameters

  • heartbeat: The heartbeat payload.
  • cancellationToken: Cancellation token.

interface IRegionProvider

public interface IRegionProvider

Provides region information for routing decisions.

Members

MemberKindSummary
NeighborRegionspropertyGets the neighbor regions in order of preference.
RegionpropertyGets the current gateway region.

property NeighborRegions #

IReadOnlyList<string> NeighborRegions { get; }

Gets the neighbor regions in order of preference.

property Region #

string Region { get; }

Gets the current gateway region.

interface IRoutingPlugin

public interface IRoutingPlugin

Provides extensibility for routing decisions.

Members

MemberKindSummary
ChooseInstanceAsync(RoutingContext, CancellationToken)methodChooses an instance for the routing context.

method ChooseInstanceAsync(RoutingContext, CancellationToken) #

Task<RoutingDecision?> ChooseInstanceAsync(RoutingContext context, CancellationToken cancellationToken)

Chooses an instance for the routing context.

Parameters

  • context: The routing context.
  • cancellationToken: Cancellation token.

Returns

The routing decision, or null if this plugin cannot decide.

interface ITransportClient

public interface ITransportClient

Represents a transport client for sending requests to microservices.

Members

MemberKindSummary
SendCancelAsync(ConnectionState, Guid, string)methodSends a cancellation request.
SendRequestAsync(ConnectionState, Frame, TimeSpan, CancellationToken)methodSends a request and waits for a response.
SendStreamingAsync(ConnectionState, Frame, Stream, Func<ResponseFrame, Stream, Task>, PayloadLimits, CancellationToken)methodSends a request whose body is read from a stream and hands the microservice’s response to readResponse.

method SendCancelAsync(ConnectionState, Guid, string) #

Task SendCancelAsync(ConnectionState connection, Guid correlationId, string? reason = null)

Sends a cancellation request.

Parameters

  • connection: The connection to use.
  • correlationId: The correlation ID of the request to cancel.
  • reason: Optional reason for cancellation.

method SendRequestAsync(ConnectionState, Frame, TimeSpan, CancellationToken) #

Task<Frame> SendRequestAsync(ConnectionState connection, Frame requestFrame, TimeSpan timeout, CancellationToken cancellationToken)

Sends a request and waits for a response.

Parameters

  • connection: The connection to use.
  • requestFrame: The request frame.
  • timeout: The timeout for the request.
  • cancellationToken: Cancellation token.

Returns

The response frame.

method SendStreamingAsync(ConnectionState, Frame, Stream, Func<ResponseFrame, Stream, Task>, PayloadLimits, CancellationToken) #

Task SendStreamingAsync(ConnectionState connection, Frame requestHeader, Stream requestBody, Func<ResponseFrame, Stream, Task> readResponse, PayloadLimits limits, CancellationToken cancellationToken)

Sends a request whose body is read from a stream and hands the microservice’s response to readResponse. TransportStreamingDispatch.SendBufferedAsync(ITransportClient, ConnectionState, Frame, Stream, Func<ResponseFrame, Stream, Task>, PayloadLimits, CancellationToken)implements it for transports whose microservice side answers a request with one response frame.

Parameters

  • connection: The connection to use.
  • requestHeader: The request header frame.
  • requestBody: The request body stream.
  • readResponse: Callback that receives the response head (the status code and headers of the microservice’s response; its ResponseFrame.Payloadis empty) and the response body stream.
  • limits: Payload limits to enforce.
  • cancellationToken: Cancellation token.

interface ITransportServer

public interface ITransportServer

Represents a transport server that accepts connections from microservices.

Members

MemberKindSummary
StartAsync(CancellationToken)methodStarts listening for incoming connections.
StopAsync(CancellationToken)methodStops accepting new connections.

method StartAsync(CancellationToken) #

Task StartAsync(CancellationToken cancellationToken)

Starts listening for incoming connections.

Parameters

  • cancellationToken: Cancellation token.

method StopAsync(CancellationToken) #

Task StopAsync(CancellationToken cancellationToken)

Stops accepting new connections.

Parameters

  • cancellationToken: Cancellation token.

class TransportStreamingDispatch

public static class TransportStreamingDispatch

The streaming dispatch of the transports whose microservice side answers each request with one response frame. The Microservice SDK dispatches one REQUEST frame and returns one RESPONSE frame; it does not assemble REQUEST_STREAM_DATA frames into a request body. So the request body is read up to PayloadLimits.MaxRequestBytesPerCalland sent as the payload of one REQUEST frame through ITransportClient.SendRequestAsync(ConnectionState, Frame, TimeSpan, CancellationToken), and the RESPONSE frame is handed over as its head (status code and headers) and its body.

Members

MemberKindSummary
SendBufferedAsync(ITransportClient, ConnectionState, Frame, Stream, Func<ResponseFrame, Stream, Task>, PayloadLimits, CancellationToken)methodSends requestBody as the payload of one request frame and passes the microservice’s response head and body to readResponse.

method SendBufferedAsync(ITransportClient, ConnectionState, Frame, Stream, Func<ResponseFrame, Stream, Task>, PayloadLimits, CancellationToken) #

public static Task SendBufferedAsync(ITransportClient client, ConnectionState connection, Frame requestHeader, Stream requestBody, Func<ResponseFrame, Stream, Task> readResponse, PayloadLimits limits, CancellationToken cancellationToken)

Sends requestBody as the payload of one request frame and passes the microservice’s response head and body to readResponse.

Parameters

  • client: The transport client that sends the request frame.
  • connection: The connection to use.
  • requestHeader: The request header frame (a REQUEST frame without a body).
  • requestBody: The request body stream.
  • readResponse: Receives the response head (empty payload) and the response body.
  • limits: Payload limits to enforce.
  • cancellationToken: Cancellation token.

Exceptions

namespace StellaOps.Router.Common.Enums

TypeKindDescription
FrameTypeenumDefines the frame types used in the router protocol.
InstanceHealthStatusenumDefines the health status of a microservice instance.
TransportTypeenumDefines the transport types supported for microservice-to-router communication.

enum FrameType

public enum FrameType

Defines the frame types used in the router protocol.

ValueDescription
Hello = 0Initial registration frame sent by microservice.
Heartbeat = 1Periodic health check frame.
Request = 2Request frame containing method, path, headers, and body.
Response = 3Response frame containing status, headers, and body.
RequestStreamData = 4Streaming request data frame.
ResponseStreamData = 5Streaming response data frame.
Cancel = 6Cancellation frame for aborting in-flight requests.
ResyncRequest = 7Gateway-to-service control frame requesting a fresh endpoint metadata replay.
EndpointsUpdate = 8Optional frame for updating endpoint metadata at runtime.
Goodbye = 9Sent by microservice to gateway immediately before shutdown to request prompt deregistration without waiting for lease expiry.

enum InstanceHealthStatus

public enum InstanceHealthStatus

Defines the health status of a microservice instance.

ValueDescription
Unknown = 0Health status is not yet determined.
Healthy = 1Instance is healthy and can accept requests.
Degraded = 2Instance is degraded but can still accept requests.
Draining = 3Instance is draining and will not accept new requests.
Unhealthy = 4Instance is unhealthy and should not receive requests.

enum TransportType

public enum TransportType

Defines the transport types supported for microservice-to-router communication. Note: HTTP is explicitly excluded per specification.

ValueDescription
InMemory = 0In-memory transport for testing and local development.
Udp = 1UDP transport for small/bounded payloads.
Tcp = 2TCP transport with length-prefixed framing.
Certificate = 3Certificate-based TCP (TLS/mTLS) transport with certificate-based authentication.
RabbitMq = 4RabbitMQ transport for queue-based communication.
Messaging = 5Messaging transport using StellaOps.Messaging (Valkey/Postgres/InMemory).

namespace StellaOps.Router.Common.Frames

TypeKindDescription
ControlFrameCodecclassEncodes and decodes the HELLO and HEARTBEAT payloads of the connection transports (TCP, TLS, UDP, RabbitMQ).
FrameCanonicalBytesclassComputes the canonical byte representation of a router frame for the purpose of HMAC sealing/verification.
FrameCanonicalBytes.DecodedFramerecordDecoded canonical frame fields.
FrameConverterclassConverts between generic Frame and typed frame records.
FrameEnvelopeOptionsclassConfiguration for the frame-layer envelope HMAC pipeline (signer + verifier).
FrameEnvelopeRejectedExceptionclassThrown when an inbound frame fails envelope-HMAC verification.
FrameEnvelopeRejectionReasonenumWhy IFrameEnvelopeVerifierrejected a frame.
FrameEnvelopeSealrecordCarries the gateway-issued integrity stamp attached to every router frame when frame-layer envelope HMAC is enforced.
FrameEnvelopeServiceCollectionExtensionsclassRegisters frame-envelope HMAC services when the operator supplies the FrameEnvelopeOptions.SectionNameconfiguration section.
HmacFrameEnvelopeSignerclassDefault IFrameEnvelopeSignerbacked by IHmacAlgorithm (HMAC-SHA256).
HmacFrameEnvelopeVerifierclassDefault IFrameEnvelopeVerifierbacked by IHmacAlgorithm.
IFrameEnvelopeSignerinterfaceSigns a router frame with the gateway-issued envelope HMAC.
IFrameEnvelopeVerifierinterfaceVerifies that a router frame carries a valid gateway-issued envelope HMAC.
PayloadTooLargeExceptionclassA frame, a datagram or a request body is larger than its transport or the configured limit accepts.
RequestFramerecordRepresents a REQUEST frame sent from gateway to microservice.
ResponseFramerecordRepresents a RESPONSE frame sent from microservice to gateway.
TransportErrorResponsesclassResponse frames a transport client sends in place of a response it cannot send.
TransportFrameHeaderclassThe frame header shared by the TCP, TLS and UDP transports: [1-byte frame type][1-byte correlation length N][N bytes UTF-8 correlation id].

class ControlFrameCodec

public static class ControlFrameCodec

Encodes and decodes the HELLO and HEARTBEAT payloads of the connection transports (TCP, TLS, UDP, RabbitMQ). Both the microservice side and the gateway side use this type, so the two ends cannot disagree on the wire format. The JSON shape (camelCase property names) is the one the Messaging transport already uses for the same records.

Members

MemberKindSummary
CreateConnectionState(string, TransportType, HelloPayload, DateTime)methodBuilds the connection state the gateway keeps for an instance that sent HELLO.
CreateHello(InstanceDescriptor, IReadOnlyList<EndpointDescriptor>, IReadOnlyDictionary<string, SchemaDefinition>, ServiceOpenApiInfo)methodBuilds the HELLO payload a microservice sends when it connects.
SerializeHeartbeat(HeartbeatPayload)methodSerializes a HEARTBEAT payload.
SerializeHello(HelloPayload)methodSerializes a HELLO payload.
TryDeserializeHeartbeat(ReadOnlySpan<byte>, out HeartbeatPayload)methodDecodes a HEARTBEAT payload.
TryDeserializeHello(ReadOnlySpan<byte>, out HelloPayload, out string)methodDecodes a HELLO payload.

method CreateConnectionState(string, TransportType, HelloPayload, DateTime) #

public static ConnectionState CreateConnectionState(string connectionId, TransportType transportType, HelloPayload hello, DateTime connectedAtUtc)

Builds the connection state the gateway keeps for an instance that sent HELLO.

Parameters

  • connectionId: The transport connection id.
  • transportType: The transport the instance connected over.
  • hello: The decoded HELLO payload.
  • connectedAtUtc: The time the HELLO was received.

Returns

The connection state with the published endpoints.

method CreateHello(InstanceDescriptor, IReadOnlyList<EndpointDescriptor>, IReadOnlyDictionary<string, SchemaDefinition>, ServiceOpenApiInfo) #

public static HelloPayload CreateHello(InstanceDescriptor instance, IReadOnlyList<EndpointDescriptor> endpoints, IReadOnlyDictionary<string, SchemaDefinition>? schemas, ServiceOpenApiInfo? openApiInfo)

Builds the HELLO payload a microservice sends when it connects.

Parameters

  • instance: The instance identity.
  • endpoints: The endpoints the instance serves.
  • schemas: Schema definitions referenced by the endpoints, or null.
  • openApiInfo: OpenAPI metadata for the service, or null.

Returns

The HELLO payload.

method SerializeHeartbeat(HeartbeatPayload) #

public static byte[] SerializeHeartbeat(HeartbeatPayload heartbeat)

Serializes a HEARTBEAT payload.

Parameters

  • heartbeat: The heartbeat payload.

Returns

The UTF-8 JSON bytes.

method SerializeHello(HelloPayload) #

public static byte[] SerializeHello(HelloPayload payload)

Serializes a HELLO payload. EndpointDescriptor.HandlerTypeis a process-local handler reference that cannot cross a process boundary; the model marks it [JsonIgnore], so it is never written.

Parameters

  • payload: The HELLO payload.

Returns

The UTF-8 JSON bytes.

method TryDeserializeHeartbeat(ReadOnlySpan<byte>, out HeartbeatPayload) #

public static bool TryDeserializeHeartbeat(ReadOnlySpan<byte> payload, out HeartbeatPayload? heartbeat)

Decodes a HEARTBEAT payload.

Parameters

  • payload: The frame payload.
  • heartbeat: The decoded payload when the method returns true.

Returns

true when the payload is a well-formed heartbeat.

method TryDeserializeHello(ReadOnlySpan<byte>, out HelloPayload, out string) #

public static bool TryDeserializeHello(ReadOnlySpan<byte> payload, out HelloPayload? hello, out string error)

Decodes a HELLO payload. An empty payload is an error: every connection transport must identify the instance and publish its endpoints in HELLO.

Parameters

  • payload: The frame payload.
  • hello: The decoded payload when the method returns true.
  • error: The reason when the method returns false.

Returns

true when the payload is a well-formed HELLO.

class FrameCanonicalBytes

public static class FrameCanonicalBytes

Computes the canonical byte representation of a router frame for the purpose of HMAC sealing/verification.

Remarks

Determinism is non-negotiable: the canonical form must be identical across processes, languages, and OS line endings, otherwise gateway and service will compute different MACs over the same frame. The encoding is therefore an explicit length-prefixed binary form with a stable header, version marker, and field order. JSON serialisation is not used here — JSON property ordering is implementation-defined and would break sealing.

Wire layout (all big-endian, explicit lengths):

  1. 4 bytes magic "FECB" (Frame Envelope Canonical Bytes).
  2. 1 byte canonical-form version (currently 1).
  3. 1 byte FrameTypeas the underlying enum value.
  4. 2-byte length + UTF-8 bytes of the correlation id (or 0 if null).
  5. 2-byte length + UTF-8 bytes of the key id.
  6. 8 bytes Unix-millisecond UTC issued-at timestamp.
  7. 4-byte length + payload bytes.

Members

MemberKindSummary
CanonicalVersionconstantCanonical-form version.
MagicfieldMagic header used to namespace the canonical bytes so a stray HMAC computation cannot accidentally validate a different binary.
Compute(Frame, string, DateTimeOffset)methodCompute canonical bytes for a frame at a specific issuance timestamp using a specific signing key id.
Decode(ReadOnlySpan<byte>)methodDecodes bytes produced by FrameCanonicalBytes.Compute(Frame, string, DateTimeOffset)back into their frame and envelope inputs.

constant CanonicalVersion #

public const byte CanonicalVersion = 1

Canonical-form version. Bump when the layout changes; verifiers reject frames with a future version they cannot decode.

field Magic #

public static readonly byte[] Magic

Magic header used to namespace the canonical bytes so a stray HMAC computation cannot accidentally validate a different binary.

method Compute(Frame, string, DateTimeOffset) #

public static byte[] Compute(Frame frame, string keyId, DateTimeOffset issuedAtUtc)

Compute canonical bytes for a frame at a specific issuance timestamp using a specific signing key id.

method Decode(ReadOnlySpan<byte>) #

public static FrameCanonicalBytes.DecodedFrame Decode(ReadOnlySpan<byte> canonicalBytes)

Decodes bytes produced by FrameCanonicalBytes.Compute(Frame, string, DateTimeOffset)back into their frame and envelope inputs.

record FrameCanonicalBytes.DecodedFrame

public sealed record DecodedFrame

Decoded canonical frame fields.

Parameters

  • Frame: The frame.
  • KeyId: The identifier of the key the frame was signed with.
  • IssuedAtUtc: When the frame was issued, in UTC.

Members

MemberKindSummary
DecodedFrame(Frame, string, DateTimeOffset)constructorDecoded canonical frame fields.
FramepropertyThe frame.
IssuedAtUtcpropertyWhen the frame was issued, in UTC.
KeyIdpropertyThe identifier of the key the frame was signed with.

constructor DecodedFrame(Frame, string, DateTimeOffset) #

public DecodedFrame(Frame Frame, string KeyId, DateTimeOffset IssuedAtUtc)

Decoded canonical frame fields.

Parameters

  • Frame: The frame.
  • KeyId: The identifier of the key the frame was signed with.
  • IssuedAtUtc: When the frame was issued, in UTC.

property Frame #

public Frame Frame { get; init; }

The frame.

property IssuedAtUtc #

public DateTimeOffset IssuedAtUtc { get; init; }

When the frame was issued, in UTC.

property KeyId #

public string KeyId { get; init; }

The identifier of the key the frame was signed with.

class FrameConverter

public static class FrameConverter

Converts between generic Frame and typed frame records.

Members

MemberKindSummary
IsGoodbyeFrame(Frame)methodReturns true when the frame is a valid Goodbye control frame.
ToFrame(RequestFrame)methodConverts a RequestFrame to a generic Frame for transport.
ToFrame(ResponseFrame)methodConverts a ResponseFrame to a generic Frame for transport.
ToGoodbyeFrame(string)methodCreates a Goodbye control frame.
ToRequestFrame(Frame)methodConverts a generic Frame to a RequestFrame.
ToResponseFrame(Frame)methodConverts a generic Frame to a ResponseFrame.

method IsGoodbyeFrame(Frame) #

public static bool IsGoodbyeFrame(Frame frame)

Returns true when the frame is a valid Goodbye control frame.

method ToFrame(RequestFrame) #

public static Frame ToFrame(RequestFrame request)

Converts a RequestFrame to a generic Frame for transport.

method ToFrame(ResponseFrame) #

public static Frame ToFrame(ResponseFrame response)

Converts a ResponseFrame to a generic Frame for transport.

method ToGoodbyeFrame(string) #

public static Frame ToGoodbyeFrame(string? correlationId = null)

Creates a Goodbye control frame. Goodbye carries no payload beyond the standard frame envelope.

method ToRequestFrame(Frame) #

public static RequestFrame? ToRequestFrame(Frame frame)

Converts a generic Frame to a RequestFrame.

method ToResponseFrame(Frame) #

public static ResponseFrame? ToResponseFrame(Frame frame)

Converts a generic Frame to a ResponseFrame.

class FrameEnvelopeOptions

public sealed class FrameEnvelopeOptions

Configuration for the frame-layer envelope HMAC pipeline (signer + verifier). All fields are deterministic; a missing / empty key map indicates the host has not been bootstrapped and the HmacFrameEnvelopeSigner/ HmacFrameEnvelopeVerifierconstructors will refuse to operate rather than fall back to “no integrity”.

Members

MemberKindSummary
FrameEnvelopeOptions()constructorCreates an instance of FrameEnvelopeOptions.
DefaultReplayWindowfieldDefault replay window.
SectionNameconstantConfiguration section under which the host binds these options.
ActiveKeyIdpropertyActive signing key id used by the signer.
KeyspropertyMap of key id to UTF-8 signing key material.
ReplayWindowpropertyHow far the issued-at timestamp on a frame may drift from “now” before the verifier rejects it.

constructor FrameEnvelopeOptions() #

public FrameEnvelopeOptions()

Creates an instance of FrameEnvelopeOptions.

field DefaultReplayWindow #

public static readonly TimeSpan DefaultReplayWindow

Default replay window. The gateway and microservices share clocks loosely (NTP), and the default accepts ±5 minutes of skew so a microservice behind a slow boot sequence still verifies new frames. Configurable to widen for offline / air-gap deployments where NTP is best-effort.

constant SectionName #

public const string SectionName = "Router:Frame:Envelope"

Configuration section under which the host binds these options.

property ActiveKeyId #

public string ActiveKeyId { get; set; }

Active signing key id used by the signer. Must be present in FrameEnvelopeOptions.Keys. Verifiers ignore this field — they trust the key id carried inside the seal — so rotation works by adding a new key to FrameEnvelopeOptions.Keyson every host first, then flipping FrameEnvelopeOptions.ActiveKeyIdon the gateway.

property Keys #

public Dictionary<string, string> Keys { get; set; }

Map of key id to UTF-8 signing key material. Multiple entries support a rotation window where verifiers accept frames signed by either the previous or the new key. Empty == disabled, which means any constructor that wires this up will throw at startup.

property ReplayWindow #

public TimeSpan ReplayWindow { get; set; }

How far the issued-at timestamp on a frame may drift from “now” before the verifier rejects it. Default: ±5 minutes. The window is applied symmetrically (past and future) to absorb gateway / service clock skew.

class FrameEnvelopeRejectedException

public sealed class FrameEnvelopeRejectedException : Exception

Thrown when an inbound frame fails envelope-HMAC verification. The metadata keys (frame.envelope.*) carry the rejection reason, the seal key id and the issue time, so log emitters can attach them to dead-letter records and traces without parsing the message.

Members

MemberKindSummary
FrameEnvelopeRejectedException(FrameEnvelopeRejectionReason, string, string, DateTimeOffset?)constructorInitializes a new instance of the FrameEnvelopeRejectedException.
MetadataKeyIssuedAtconstantAudit-metadata key carrying the issued-at timestamp (ISO-8601 UTC, when present).
MetadataKeyKeyIdconstantAudit-metadata key carrying the seal key id (when present).
MetadataKeyReasonconstantAudit-metadata key carrying the reason label.
IssuedAtUtcpropertyIssued-at timestamp from the seal, when one was attached.
KeyIdpropertyKey id presented by the seal, when one was attached.
ReasonpropertyWhy the verifier rejected the frame.

constructor FrameEnvelopeRejectedException(FrameEnvelopeRejectionReason, string, string, DateTimeOffset?) #

public FrameEnvelopeRejectedException(FrameEnvelopeRejectionReason reason, string message, string? keyId = null, DateTimeOffset? issuedAtUtc = null)

Initializes a new instance of the FrameEnvelopeRejectedException.

constant MetadataKeyIssuedAt #

public const string MetadataKeyIssuedAt = "frame.envelope.issuedAt"

Audit-metadata key carrying the issued-at timestamp (ISO-8601 UTC, when present).

constant MetadataKeyKeyId #

public const string MetadataKeyKeyId = "frame.envelope.keyId"

Audit-metadata key carrying the seal key id (when present).

constant MetadataKeyReason #

public const string MetadataKeyReason = "frame.envelope.reason"

Audit-metadata key carrying the reason label.

property IssuedAtUtc #

public DateTimeOffset? IssuedAtUtc { get; }

Issued-at timestamp from the seal, when one was attached.

property KeyId #

public string? KeyId { get; }

Key id presented by the seal, when one was attached.

property Reason #

public FrameEnvelopeRejectionReason Reason { get; }

Why the verifier rejected the frame.

enum FrameEnvelopeRejectionReason

public enum FrameEnvelopeRejectionReason

Why IFrameEnvelopeVerifierrejected a frame. Fields double as the reason label on the router_frame_envelope_verify_failed_total counter so SREs can alert on each failure mode separately.

ValueDescription
Missing = 0No FrameEnvelopeSealattached to the frame.
UnknownKeyId = 1Seal carries a key id the verifier does not recognise.
UnsupportedAlgorithm = 2Seal algorithm marker is not supported by this verifier.
Malformed = 3Seal MAC is not valid Base64Url or has the wrong length for the algorithm.
TimestampOutOfWindow = 4Issued-at timestamp is outside the configured replay window.
MacMismatch = 5MAC bytes did not authenticate the canonical frame bytes (tamper or wrong key).
UnsupportedCanonicalVersion = 6Canonical-form version on the wire is unknown to this verifier.

record FrameEnvelopeSeal

public sealed record FrameEnvelopeSeal

Carries the gateway-issued integrity stamp attached to every router frame when frame-layer envelope HMAC is enforced. The seal binds the canonical frame header bytes to the signing key held by the gateway so that any transport — TCP, UDP, TLS, Messaging, RabbitMq, InMemory — can detect tampering and replay before dispatching the frame.

Remarks

The seal holds a key identifier (so keys can rotate without a coordinated downtime), the issuance timestamp (used to enforce the configurable replay window), the algorithm marker and the MAC bytes. The algorithm is HMAC-SHA256, as for the gateway-issued identity envelope. The seal records the algorithm marker, so another algorithm needs no change of the wire format.

Members

MemberKindSummary
FrameEnvelopeSeal()constructorCreates an instance of FrameEnvelopeSeal.
AlgorithmHs256constantHMAC algorithm marker used when computing the seal.
AlgorithmpropertyHMAC algorithm marker.
IssuedAtUtcpropertyUTC timestamp at which the gateway stamped the frame.
KeyIdpropertyIdentifier of the signing key used to compute the MAC.
MacpropertyBase64Url-encoded MAC bytes.

constructor FrameEnvelopeSeal() #

public FrameEnvelopeSeal()

Creates an instance of FrameEnvelopeSeal.

constant AlgorithmHs256 #

public const string AlgorithmHs256 = "HS256"

HMAC algorithm marker used when computing the seal. Matches the wire alias used by GatewayIdentityEnvelopeCodec.

property Algorithm #

public string Algorithm { get; init; }

HMAC algorithm marker. Currently FrameEnvelopeSeal.AlgorithmHs256; widen only by adding new constants — do not repurpose existing ones, since older verifiers must continue to recognise the marker.

property IssuedAtUtc #

public required DateTimeOffset IssuedAtUtc { get; init; }

UTC timestamp at which the gateway stamped the frame. Used by the verifier to enforce the replay window.

property KeyId #

public required string KeyId { get; init; }

Identifier of the signing key used to compute the MAC. Must be stable across services so verifiers can route a frame to the correct key material when more than one key is loaded (rotation window).

property Mac #

public required string Mac { get; init; }

Base64Url-encoded MAC bytes. The MAC is computed over the canonical frame header bytes produced by FrameCanonicalBytesusing the key identified by FrameEnvelopeSeal.KeyId.

class FrameEnvelopeServiceCollectionExtensions

public static class FrameEnvelopeServiceCollectionExtensions

Registers frame-envelope HMAC services when the operator supplies the FrameEnvelopeOptions.SectionNameconfiguration section.

Members

MemberKindSummary
AddConfiguredFrameEnvelopeProtection(IServiceCollection, IConfiguration)extension methodBinds and validates frame-envelope options, then registers the signer and verifier.

extension method AddConfiguredFrameEnvelopeProtection(IServiceCollection, IConfiguration) #

public static IServiceCollection AddConfiguredFrameEnvelopeProtection(this IServiceCollection services, IConfiguration configuration)

Binds and validates frame-envelope options, then registers the signer and verifier. Hosts without the configuration section retain the documented bootstrap posture; a present but invalid section fails registration instead of silently disabling integrity.

Parameters

  • services: The service collection.
  • configuration: The host configuration root.

Returns

The service collection for chaining.

class HmacFrameEnvelopeSigner

public sealed class HmacFrameEnvelopeSigner : IFrameEnvelopeSigner

Default IFrameEnvelopeSignerbacked by IHmacAlgorithm (HMAC-SHA256). Stamps a producer-issued envelope seal over canonical frame bytes.

Remarks

Every frame producer signs its outbound request, response, and control frames; every consumer uses HmacFrameEnvelopeVerifierto authenticate frames it receives. The HMAC primitive is taken from IHmacAlgorithm; the signer makes no direct BCL HMAC call.

Members

MemberKindSummary
HmacFrameEnvelopeSigner(IOptions<FrameEnvelopeOptions>, IHmacAlgorithm, TimeProvider)constructorInitializes a new instance of the HmacFrameEnvelopeSignerclass.
Sign(Frame)methodCompute a seal for frame.

constructor HmacFrameEnvelopeSigner(IOptions<FrameEnvelopeOptions>, IHmacAlgorithm, TimeProvider) #

public HmacFrameEnvelopeSigner(IOptions<FrameEnvelopeOptions> options, IHmacAlgorithm? hmac = null, TimeProvider? timeProvider = null)

Initializes a new instance of the HmacFrameEnvelopeSignerclass.

method Sign(Frame) #

public FrameEnvelopeSeal Sign(Frame frame)

Compute a seal for frame. Implementations are expected to read “now” via the TimeProvider wired into them, so determinism tests can substitute a fake clock.

class HmacFrameEnvelopeVerifier

public sealed class HmacFrameEnvelopeVerifier : IFrameEnvelopeVerifier

Default IFrameEnvelopeVerifierbacked by IHmacAlgorithm. Recomputes canonical frame bytes against the key id presented in the seal, enforces the configured replay window using TimeProvider, and rejects on any mismatch with a structured FrameEnvelopeRejectedException.

Members

MemberKindSummary
HmacFrameEnvelopeVerifier(IOptions<FrameEnvelopeOptions>, IHmacAlgorithm, TimeProvider)constructorInitializes a new instance of the HmacFrameEnvelopeVerifierclass.
TryVerify(Frame, FrameEnvelopeSeal, out FrameEnvelopeRejectionReason)methodTry-style overload.
Verify(Frame, FrameEnvelopeSeal)methodVerify the seal attached to frame.

constructor HmacFrameEnvelopeVerifier(IOptions<FrameEnvelopeOptions>, IHmacAlgorithm, TimeProvider) #

public HmacFrameEnvelopeVerifier(IOptions<FrameEnvelopeOptions> options, IHmacAlgorithm? hmac = null, TimeProvider? timeProvider = null)

Initializes a new instance of the HmacFrameEnvelopeVerifierclass.

method TryVerify(Frame, FrameEnvelopeSeal, out FrameEnvelopeRejectionReason) #

public bool TryVerify(Frame frame, FrameEnvelopeSeal? seal, out FrameEnvelopeRejectionReason reason)

Try-style overload. Returns true on success, otherwise sets reason to the failure label and returns false. Useful where a transport wants to emit a counter increment without paying the cost of throwing.

method Verify(Frame, FrameEnvelopeSeal) #

public void Verify(Frame frame, FrameEnvelopeSeal seal)

Verify the seal attached to frame. Throws FrameEnvelopeRejectedExceptionon failure with a structured reason; transports that rely on at-least-once delivery (Messaging, RabbitMq) catch and dead-letter on this exception.

Parameters

  • frame: The frame to verify.
  • seal: The seal claimed for this frame, as transported alongside it.

interface IFrameEnvelopeSigner

public interface IFrameEnvelopeSigner

Signs a router frame with the gateway-issued envelope HMAC.

Remarks

Every router frame leaving a host must carry a FrameEnvelopeSealstamped over canonical frame bytes. The signer computes the MAC through StellaOps.Cryptography.IHmacAlgorithm, so a host can substitute the MAC implementation.

Members

MemberKindSummary
Sign(Frame)methodCompute a seal for frame.

method Sign(Frame) #

FrameEnvelopeSeal Sign(Frame frame)

Compute a seal for frame. Implementations are expected to read “now” via the TimeProvider wired into them, so determinism tests can substitute a fake clock.

interface IFrameEnvelopeVerifier

public interface IFrameEnvelopeVerifier

Verifies that a router frame carries a valid gateway-issued envelope HMAC.

Members

MemberKindSummary
TryVerify(Frame, FrameEnvelopeSeal, out FrameEnvelopeRejectionReason)methodTry-style overload.
Verify(Frame, FrameEnvelopeSeal)methodVerify the seal attached to frame.

method TryVerify(Frame, FrameEnvelopeSeal, out FrameEnvelopeRejectionReason) #

bool TryVerify(Frame frame, FrameEnvelopeSeal? seal, out FrameEnvelopeRejectionReason reason)

Try-style overload. Returns true on success, otherwise sets reason to the failure label and returns false. Useful where a transport wants to emit a counter increment without paying the cost of throwing.

method Verify(Frame, FrameEnvelopeSeal) #

void Verify(Frame frame, FrameEnvelopeSeal seal)

Verify the seal attached to frame. Throws FrameEnvelopeRejectedExceptionon failure with a structured reason; transports that rely on at-least-once delivery (Messaging, RabbitMq) catch and dead-letter on this exception.

Parameters

  • frame: The frame to verify.
  • seal: The seal claimed for this frame, as transported alongside it.

class PayloadTooLargeException

public sealed class PayloadTooLargeException : Exception

A frame, a datagram or a request body is larger than its transport or the configured limit accepts. It is raised before anything is sent, so the connection stays usable; the gateway answers the caller 413 Payload Too Large.

Members

MemberKindSummary
PayloadTooLargeException(long, long)constructorInitializes a new instance of the PayloadTooLargeExceptionclass.
ActualSizepropertyGets the size, in bytes, that exceeded the limit.
MaxSizepropertyGets the limit, in bytes.

constructor PayloadTooLargeException(long, long) #

public PayloadTooLargeException(long actualSize, long maxSize)

Initializes a new instance of the PayloadTooLargeExceptionclass.

Parameters

  • actualSize: The size, in bytes, that exceeded the limit.
  • maxSize: The limit, in bytes.

property ActualSize #

public long ActualSize { get; }

Gets the size, in bytes, that exceeded the limit.

property MaxSize #

public long MaxSize { get; }

Gets the limit, in bytes.

record RequestFrame

public sealed record RequestFrame

Represents a REQUEST frame sent from gateway to microservice.

Members

MemberKindSummary
RequestFrame()constructorCreates an instance of RequestFrame.
CorrelationIdpropertyGets the correlation ID for distributed tracing.
HeaderspropertyGets the request headers.
MethodpropertyGets the HTTP method (GET, POST, PUT, DELETE, etc.).
PathpropertyGets the request path.
PayloadpropertyGets the request payload (body).
RawTargetpropertyGets the request target exactly as the gateway received it on the ingress wire (path plus query string, percent-encoding intact), after the gateway translated the route prefix the same way it translated RequestFrame.Path.
RequestIdpropertyGets the unique request ID for this request.
SupportsStreamingpropertyGets whether this request supports streaming response.
TimeoutSecondspropertyGets the timeout in seconds for this request.

constructor RequestFrame() #

public RequestFrame()

Creates an instance of RequestFrame.

property CorrelationId #

public string? CorrelationId { get; init; }

Gets the correlation ID for distributed tracing.

property Headers #

public IReadOnlyDictionary<string, string> Headers { get; init; }

Gets the request headers.

property Method #

public required string Method { get; init; }

Gets the HTTP method (GET, POST, PUT, DELETE, etc.).

property Path #

public required string Path { get; init; }

Gets the request path.

property Payload #

public ReadOnlyMemory<byte> Payload { get; init; }

Gets the request payload (body).

property RawTarget #

public string? RawTarget { get; init; }

Gets the request target exactly as the gateway received it on the ingress wire (path plus query string, percent-encoding intact), after the gateway translated the route prefix the same way it translated RequestFrame.Path. Null when the ingress exposed no raw target (a gateway built before this field existed, or a synthetic caller).

Remarks

RequestFrame.Pathis the once-decoded, re-escaped form ASP.NET hands the gateway, so a canonical %252F on the wire has already become %2F there. Endpoints that must decode a segment exactly once (product keys carrying canonical PURL escapes) read IHttpRequestFeature.RawTarget instead of the route value; the ASP.NET dispatcher populates that feature from this value and, when it is absent, from RequestFrame.Path.

property RequestId #

public required string RequestId { get; init; }

Gets the unique request ID for this request.

property SupportsStreaming #

public bool SupportsStreaming { get; init; }

Gets whether this request supports streaming response.

property TimeoutSeconds #

public int TimeoutSeconds { get; init; }

Gets the timeout in seconds for this request.

record ResponseFrame

public sealed record ResponseFrame

Represents a RESPONSE frame sent from microservice to gateway.

Members

MemberKindSummary
ResponseFrame()constructorCreates an instance of ResponseFrame.
HasMoreChunkspropertyGets whether there are more streaming chunks to follow.
HeaderspropertyGets the response headers.
PayloadpropertyGets the response payload (body).
RequestIdpropertyGets the request ID this response is for.
StatusCodepropertyGets the HTTP status code.

constructor ResponseFrame() #

public ResponseFrame()

Creates an instance of ResponseFrame.

property HasMoreChunks #

public bool HasMoreChunks { get; init; }

Gets whether there are more streaming chunks to follow.

property Headers #

public IReadOnlyDictionary<string, string> Headers { get; init; }

Gets the response headers.

property Payload #

public ReadOnlyMemory<byte> Payload { get; init; }

Gets the response payload (body).

property RequestId #

public required string RequestId { get; init; }

Gets the request ID this response is for.

property StatusCode #

public int StatusCode { get; init; }

Gets the HTTP status code.

class TransportErrorResponses

public static class TransportErrorResponses

Response frames a transport client sends in place of a response it cannot send.

Members

MemberKindSummary
ResponseTooLargeTypeconstantThe type of the problem a TransportErrorResponses.ResponseTooLarge(string, long, long)frame carries.
ResponseTooLarge(string, long, long)methodA 502 response frame for a response whose frame is larger than the transport carries (PayloadTooLargeExceptionon the write).

constant ResponseTooLargeType #

public const string ResponseTooLargeType = "urn:stellaops:router:response-too-large"

The type of the problem a TransportErrorResponses.ResponseTooLarge(string, long, long)frame carries.

method ResponseTooLarge(string, long, long) #

public static Frame ResponseTooLarge(string correlationId, long actualBytes, long maxBytes)

A 502 response frame for a response whose frame is larger than the transport carries (PayloadTooLargeExceptionon the write). The gateway passes it to the caller at once instead of waiting for the endpoint timeout.

Parameters

  • correlationId: The correlation id of the request.
  • actualBytes: The size of the refused response frame, in bytes.
  • maxBytes: The transport’s frame or datagram limit, in bytes.

Returns

The response frame.

class TransportFrameHeader

public static class TransportFrameHeader

The frame header shared by the TCP, TLS and UDP transports: [1-byte frame type][1-byte correlation length N][N bytes UTF-8 correlation id]. The correlation id is carried exactly as the sender set it (the gateway issues ULIDs), so a response can be matched to its request. A zero length means no correlation id.

Members

MemberKindSummary
MaxCorrelationIdBytesconstantThe largest correlation id, in UTF-8 bytes, that fits the one-byte length field.
MinimumSizeconstantThe size of a header without a correlation id.
GetSize(string)methodGets the header size for a correlation id.
TryRead(ReadOnlySpan<byte>, out FrameType, out string, out int, out string)methodReads the header.
Write(Span<byte>, FrameType, string)methodWrites the header.

constant MaxCorrelationIdBytes #

public const int MaxCorrelationIdBytes = 255

The largest correlation id, in UTF-8 bytes, that fits the one-byte length field.

constant MinimumSize #

public const int MinimumSize = 2

The size of a header without a correlation id.

method GetSize(string) #

public static int GetSize(string? correlationId)

Gets the header size for a correlation id.

Parameters

  • correlationId: The correlation id, or null.

Returns

The number of header bytes.

Exceptions

method TryRead(ReadOnlySpan<byte>, out FrameType, out string, out int, out string) #

public static bool TryRead(ReadOnlySpan<byte> source, out FrameType frameType, out string? correlationId, out int headerSize, out string error)

Reads the header.

Parameters

  • source: The frame bytes, starting with the header.
  • frameType: The frame type.
  • correlationId: The correlation id, or null when the length is zero.
  • headerSize: The number of header bytes read.
  • error: The reason when the method returns false.

Returns

true when the header is well formed.

method Write(Span<byte>, FrameType, string) #

public static int Write(Span<byte> destination, FrameType frameType, string? correlationId)

Writes the header.

Parameters

Returns

The number of bytes written.

Exceptions

  • ArgumentException: The correlation id is too long or the buffer too small.

namespace StellaOps.Router.Common.Identity

TypeKindDescription
GatewayIdentityEnveloperecordSigned gateway-issued identity envelope used for trusted user impersonation when requests are dispatched through the Router gateway.
GatewayIdentityEnvelopeCodecclassCodec for creating and verifying signed identity envelopes.
GatewayIdentityEnvelopeSignaturestructResult of envelope signing operation.

record GatewayIdentityEnvelope

public sealed record GatewayIdentityEnvelope

Signed gateway-issued identity envelope used for trusted user impersonation when requests are dispatched through the Router gateway.

Members

MemberKindSummary
GatewayIdentityEnvelope()constructorCreates an instance of GatewayIdentityEnvelope.
ClaimspropertyGateway-validated non-scope claims that downstream services need for resource-level authorization decisions.
CorrelationIdpropertyCorrelation identifier for audit traceability.
ExpiresAtUtcpropertyEnvelope expiry timestamp (UTC).
IssuedAtUtcpropertyEnvelope issuance timestamp (UTC).
IssuerpropertyGateway issuer identifier.
ProjectpropertyProject identifier, when available.
RolespropertyEffective roles enforced by the gateway.
ScopespropertyEffective scopes enforced by the gateway.
SenderConfirmationpropertySender confirmation thumbprint (for example DPoP JKT) when available.
SubjectpropertySubject (authenticated actor).
TenantpropertyTenant identifier, when available.
VersionpropertyEnvelope schema version.

constructor GatewayIdentityEnvelope() #

public GatewayIdentityEnvelope()

Creates an instance of GatewayIdentityEnvelope.

property Claims #

public Dictionary<string, string[]> Claims { get; init; }

Gateway-validated non-scope claims that downstream services need for resource-level authorization decisions.

property CorrelationId #

public string CorrelationId { get; init; }

Correlation identifier for audit traceability.

property ExpiresAtUtc #

public DateTimeOffset ExpiresAtUtc { get; init; }

Envelope expiry timestamp (UTC).

property IssuedAtUtc #

public DateTimeOffset IssuedAtUtc { get; init; }

Envelope issuance timestamp (UTC).

property Issuer #

public string Issuer { get; init; }

Gateway issuer identifier.

property Project #

public string? Project { get; init; }

Project identifier, when available.

property Roles #

public IReadOnlyList<string> Roles { get; init; }

Effective roles enforced by the gateway.

property Scopes #

public IReadOnlyList<string> Scopes { get; init; }

Effective scopes enforced by the gateway.

property SenderConfirmation #

public string? SenderConfirmation { get; init; }

Sender confirmation thumbprint (for example DPoP JKT) when available.

property Subject #

public string Subject { get; init; }

Subject (authenticated actor).

property Tenant #

public string? Tenant { get; init; }

Tenant identifier, when available.

property Version #

public int Version { get; init; }

Envelope schema version.

class GatewayIdentityEnvelopeCodec

public static class GatewayIdentityEnvelopeCodec

Codec for creating and verifying signed identity envelopes.

Remarks

The gateway seals every request it dispatches with this envelope, and every downstream service verifies it.

The MAC is computed through the ICryptoHmac abstraction for the authentication purpose (HmacPurpose.Authentication), not for document signing. The gateway and the services resolve the same implementation, so both sides compute the same algorithm and verification needs no further configuration.

Callers that omit the ICryptoHmac argument (or pass a DI lookup that found none) get DefaultCryptoPrimitives.Hmac: HMAC-SHA256, through the dependency-free Sha2CryptoHmac unless the host deploys its own crypto provider.

Members

MemberKindSummary
AlgorithmHs256constantAlgorithm marker used for generated signatures under the default world compliance profile.
Sign(GatewayIdentityEnvelope, string, ICryptoHmac)methodCreates a signed identity envelope.
TryVerify(string, string, string, ICryptoHmac, out GatewayIdentityEnvelope)methodTries to verify and decode a signed identity envelope using the supplied compliance-aware HMAC primitive.
TryVerify(string, string, string, out GatewayIdentityEnvelope)methodTries to verify and decode a signed identity envelope.

constant AlgorithmHs256 #

public const string AlgorithmHs256 = "HS256"

Algorithm marker used for generated signatures under the default world compliance profile. Retained for backwards compatibility with existing tests and downstream consumers; the GatewayIdentityEnvelopeSignature.Algorithmfield of new signatures is populated dynamically from ICryptoHmac.GetAlgorithmForPurpose(string).

method Sign(GatewayIdentityEnvelope, string, ICryptoHmac) #

public static GatewayIdentityEnvelopeSignature Sign(GatewayIdentityEnvelope envelope, string signingKey, ICryptoHmac? hmac = null)

Creates a signed identity envelope. The HMAC algorithm is chosen by the active regional compliance profile via ICryptoHmac, for the purpose HmacPurpose.Authentication.

Parameters

  • envelope: Envelope payload to sign.
  • signingKey: Shared signing key.
  • hmac: Compliance-aware HMAC primitive. When null, falls back to DefaultCryptoPrimitives.Hmac so callers without DI (tests, ad-hoc helpers, hosts that register none) keep working unchanged.

method TryVerify(string, string, string, ICryptoHmac, out GatewayIdentityEnvelope) #

public static bool TryVerify(string payload, string signature, string signingKey, ICryptoHmac? hmac, out GatewayIdentityEnvelope? envelope)

Tries to verify and decode a signed identity envelope using the supplied compliance-aware HMAC primitive.

method TryVerify(string, string, string, out GatewayIdentityEnvelope) #

public static bool TryVerify(string payload, string signature, string signingKey, out GatewayIdentityEnvelope? envelope)

Tries to verify and decode a signed identity envelope. The HMAC algorithm matches the active regional compliance profile resolved through ICryptoHmac.

struct GatewayIdentityEnvelopeSignature

public readonly struct GatewayIdentityEnvelopeSignature : IEquatable<GatewayIdentityEnvelopeSignature>

Result of envelope signing operation.

Parameters

  • Payload: The encoded envelope payload.
  • Signature: The signature of the payload.
  • Algorithm: The algorithm the signature was made with.

Members

MemberKindSummary
GatewayIdentityEnvelopeSignature(string, string, string)constructorResult of envelope signing operation.
AlgorithmpropertyThe algorithm the signature was made with.
PayloadpropertyThe encoded envelope payload.
SignaturepropertyThe signature of the payload.

constructor GatewayIdentityEnvelopeSignature(string, string, string) #

public GatewayIdentityEnvelopeSignature(string Payload, string Signature, string Algorithm)

Result of envelope signing operation.

Parameters

  • Payload: The encoded envelope payload.
  • Signature: The signature of the payload.
  • Algorithm: The algorithm the signature was made with.

property Algorithm #

public string Algorithm { get; init; }

The algorithm the signature was made with.

property Payload #

public string Payload { get; init; }

The encoded envelope payload.

property Signature #

public string Signature { get; init; }

The signature of the payload.

namespace StellaOps.Router.Common.Models

TypeKindDescription
CancelPayloadrecordPayload for the Cancel frame.
CancelReasonsclassStandard reasons for request cancellation.
ClaimRequirementrecordRepresents a claim requirement for endpoint authorization.
ConnectionStateclassRepresents the state of a connection between a microservice and the router.
EndpointAuthorizationSemanticsclassResolves effective authorization semantics for endpoint descriptors.
EndpointAuthorizationSourceenumSource of authorization metadata for an endpoint descriptor.
EndpointDescriptorrecordDescribes an endpoint’s identity and metadata.
EndpointSchemaInforecordSchema metadata for an endpoint, referencing schemas by ID.
EndpointsUpdatePayloadrecordPayload for the EndpointsUpdate frame sent by a microservice after the router requests a metadata replay.
FramerecordRepresents a protocol frame in the router transport layer.
HeartbeatPayloadrecordPayload for the Heartbeat frame sent periodically by microservices.
HelloPayloadrecordPayload for the Hello frame sent by microservices on connection.
InstanceDescriptorrecordDescribes a microservice instance’s identity.
PayloadLimitsclassConfiguration for payload and memory limits.
QueryParameterInforecordLightweight query parameter descriptor that can be serialized in the HELLO payload.
RegistrationResyncRequestPayloadrecordPayload for the ResyncRequest frame sent by the router when it needs a fresh endpoint metadata replay.
RouterTransportCapabilitiesclassCanonical capability identifiers advertised by router transport connections.
RoutingContextrecordNeutral routing context that does not depend on ASP.NET.
RoutingDecisionrecordRepresents the outcome of a routing decision.
SchemaDefinitionrecordA JSON Schema definition for request or response validation.
ServiceOpenApiInforecordOpenAPI metadata for a microservice.
StreamDataPayloadrecordPayload for streaming data frames (REQUEST_STREAM_DATA/RESPONSE_STREAM_DATA).
StreamingOptionsrecordConfiguration options for streaming operations.
TransportDefaultPortsclassThe default ports of the connection transports.

record CancelPayload

public sealed record CancelPayload

Payload for the Cancel frame.

Members

MemberKindSummary
CancelPayload()constructorCreates an instance of CancelPayload.
ReasonpropertyGets the reason for cancellation.

constructor CancelPayload() #

public CancelPayload()

Creates an instance of CancelPayload.

property Reason #

public string? Reason { get; init; }

Gets the reason for cancellation.

class CancelReasons

public static class CancelReasons

Standard reasons for request cancellation.

Members

MemberKindSummary
ClientDisconnectedconstantThe HTTP client disconnected before the request completed.
ConnectionClosedconstantThe transport connection was closed unexpectedly.
PayloadLimitExceededconstantThe request or response payload exceeded configured limits.
ShutdownconstantThe gateway or microservice is shutting down.
TimeoutconstantThe request exceeded its timeout.

constant ClientDisconnected #

public const string ClientDisconnected = "ClientDisconnected"

The HTTP client disconnected before the request completed.

constant ConnectionClosed #

public const string ConnectionClosed = "ConnectionClosed"

The transport connection was closed unexpectedly.

constant PayloadLimitExceeded #

public const string PayloadLimitExceeded = "PayloadLimitExceeded"

The request or response payload exceeded configured limits.

constant Shutdown #

public const string Shutdown = "Shutdown"

The gateway or microservice is shutting down.

constant Timeout #

public const string Timeout = "Timeout"

The request exceeded its timeout.

record ClaimRequirement

public sealed record ClaimRequirement

Represents a claim requirement for endpoint authorization.

Members

MemberKindSummary
ClaimRequirement()constructorCreates an instance of ClaimRequirement.
AllowedValuespropertyWhen non-null and non-empty, the requirement is satisfied if the principal presents ANY one of these values for ClaimRequirement.Type.
TypepropertyGets the claim type that must be present.
ValuepropertyGets the optional claim value that must match.

constructor ClaimRequirement() #

public ClaimRequirement()

Creates an instance of ClaimRequirement.

property AllowedValues #

public IReadOnlyList<string>? AllowedValues { get; init; }

When non-null and non-empty, the requirement is satisfied if the principal presents ANY one of these values for ClaimRequirement.Type. Used for any-of scope policies (e.g. orch:read OR script:read). Takes precedence over ClaimRequirement.Value.

property Type #

public required string Type { get; init; }

Gets the claim type that must be present.

property Value #

public string? Value { get; init; }

Gets the optional claim value that must match. Used for single-value AND-style requirements. Ignored when ClaimRequirement.AllowedValuesis set.

class ConnectionState

public sealed class ConnectionState

Represents the state of a connection between a microservice and the router.

Members

MemberKindSummary
ConnectionState()constructorCreates an instance of ConnectionState.
AveragePingMspropertyGets or sets the average ping time in milliseconds.
ConnectedAtUtcpropertyGets the UTC timestamp when this connection was established.
ConnectionIdpropertyGets the unique identifier for this connection.
EndpointspropertyGets the endpoints served by this connection.
InstancepropertyGets the instance descriptor for the connected microservice.
LastHeartbeatUtcpropertyGets or sets the UTC timestamp of the last heartbeat.
OpenApiInfopropertyGets the OpenAPI metadata for this connection’s service.
SchemaspropertyGets the schema definitions for this connection’s service.
StatuspropertyGets or sets the health status of this connection.
TransportCapabilitiespropertyGets the transport capabilities advertised by this exact connection.
TransportTypepropertyGets the transport type used for this connection.

constructor ConnectionState() #

public ConnectionState()

Creates an instance of ConnectionState.

property AveragePingMs #

public double AveragePingMs { get; set; }

Gets or sets the average ping time in milliseconds.

property ConnectedAtUtc #

public DateTime ConnectedAtUtc { get; init; }

Gets the UTC timestamp when this connection was established.

property ConnectionId #

public required string ConnectionId { get; init; }

Gets the unique identifier for this connection.

property Endpoints #

public Dictionary<(string Method, string Path), EndpointDescriptor> Endpoints { get; }

Gets the endpoints served by this connection.

property Instance #

public required InstanceDescriptor Instance { get; init; }

Gets the instance descriptor for the connected microservice.

property LastHeartbeatUtc #

public DateTime LastHeartbeatUtc { get; set; }

Gets or sets the UTC timestamp of the last heartbeat.

property OpenApiInfo #

public ServiceOpenApiInfo? OpenApiInfo { get; init; }

Gets the OpenAPI metadata for this connection’s service.

property Schemas #

public IReadOnlyDictionary<string, SchemaDefinition> Schemas { get; init; }

Gets the schema definitions for this connection’s service. Keys are schema IDs referenced by EndpointDescriptor.SchemaInfo.

property Status #

public InstanceHealthStatus Status { get; set; }

Gets or sets the health status of this connection.

property TransportCapabilities #

public IReadOnlyList<string> TransportCapabilities { get; init; }

Gets the transport capabilities advertised by this exact connection.

property TransportType #

public required TransportType TransportType { get; init; }

Gets the transport type used for this connection.

class EndpointAuthorizationSemantics

public static class EndpointAuthorizationSemantics

Resolves effective authorization semantics for endpoint descriptors.

Members

MemberKindSummary
ResolveRequiresAuthentication(EndpointDescriptor)methodResolves whether an endpoint should require an authenticated principal.
ResolveRequiresAuthentication(bool, bool, EndpointAuthorizationSource, IReadOnlyList<ClaimRequirement>, IReadOnlyList<string>, IReadOnlyList<string>)methodResolves whether an endpoint should require an authenticated principal.

method ResolveRequiresAuthentication(EndpointDescriptor) #

public static bool ResolveRequiresAuthentication(EndpointDescriptor endpoint)

Resolves whether an endpoint should require an authenticated principal.

method ResolveRequiresAuthentication(bool, bool, EndpointAuthorizationSource, IReadOnlyList<ClaimRequirement>, IReadOnlyList<string>, IReadOnlyList<string>) #

public static bool ResolveRequiresAuthentication(bool allowAnonymous, bool requiresAuthentication, EndpointAuthorizationSource source, IReadOnlyList<ClaimRequirement>? requiringClaims = null, IReadOnlyList<string>? authorizationPolicies = null, IReadOnlyList<string>? roles = null)

Resolves whether an endpoint should require an authenticated principal.

enum EndpointAuthorizationSource

public enum EndpointAuthorizationSource

Source of authorization metadata for an endpoint descriptor.

ValueDescription
None = 0No authorization metadata found.
AspNetMetadata = 1Authorization derived from ASP.NET metadata.
YamlOverride = 2Authorization defined by YAML endpoint overrides.
Hybrid = 3Authorization merged from ASP.NET metadata and YAML overrides.
AuthorityOverride = 4Authorization overridden by Authority.

record EndpointDescriptor

public sealed record EndpointDescriptor

Describes an endpoint’s identity and metadata.

Members

MemberKindSummary
EndpointDescriptor()constructorCreates an instance of EndpointDescriptor.
AnyMethodconstantThe EndpointDescriptor.Methodof an endpoint that accepts any HTTP method: an ASP.NET Core endpoint mapped without an HTTP method filter, or a wildcard.
AllowAnonymouspropertyGets a value indicating whether this endpoint explicitly allows anonymous access.
AuthorizationFullyMappedpropertyGets a value indicating whether the publishing service resolved and translated EVERY authorization rule it declared on this endpoint.
AuthorizationPoliciespropertyGets named authorization policies discovered for this endpoint.
AuthorizationSourcepropertyGets the source of the authorization metadata.
DefaultTimeoutpropertyGets the default timeout for this endpoint.
HandlerTypepropertyGets the handler type that processes requests for this endpoint.
MethodpropertyGets the HTTP method token as the endpoint configures it (GET, POST, PUT, PATCH, DELETE or another token), or EndpointDescriptor.AnyMethod.
PathpropertyGets the path template (e.g., “/billing/invoices/{id}”), with its letter case, its slashes and its catch-all, optional and default-value markers as configured.
RequiresAuthenticationpropertyGets a value indicating whether this endpoint requires an authenticated principal.
RequiringClaimspropertyGets the claim requirements for authorization.
RolespropertyGets role names required by endpoint metadata.
SchemaInfopropertyGets the schema information for this endpoint.
ServiceNamepropertyGets the name of the service that owns this endpoint.
SupportsStreamingpropertyGets a value indicating whether this endpoint supports streaming.
UnmappedAuthorizationRequirementspropertyGets the requirement type names the publishing service DECLARED and could not translate into a claim requirement — an AssertionRequirement from RequireAssertion(...), an unresolvable named policy, a custom requirement exposing no scope property.
VersionpropertyGets the semantic version of the service.

constructor EndpointDescriptor() #

public EndpointDescriptor()

Creates an instance of EndpointDescriptor.

constant AnyMethod #

public const string AnyMethod = "*"

The EndpointDescriptor.Methodof an endpoint that accepts any HTTP method: an ASP.NET Core endpoint mapped without an HTTP method filter, or a wildcard. The gateway routes every request method to it, after an endpoint of the same path that names the method.

property AllowAnonymous #

public bool AllowAnonymous { get; init; }

Gets a value indicating whether this endpoint explicitly allows anonymous access.

property AuthorizationFullyMapped #

public bool AuthorizationFullyMapped { get; init; }

Gets a value indicating whether the publishing service resolved and translated EVERY authorization rule it declared on this endpoint.

Remarks

The gateway is the only enforcement point on the router-dispatched path (the ASP.NET Core bridge dispatches a request without the host’s authorization middleware), and it enforces exactly EndpointDescriptor.RequiringClaims. When that list is empty, the gateway cannot tell “this endpoint requires only authentication” from “this endpoint declared a rule the service could not translate”. This flag makes that distinction, and it is the service’s own assurance: false is the default, so the gateway refuses a request to an endpoint that declares a named authorization policy unless the service reports its authorization as fully mapped.

property AuthorizationPolicies #

public IReadOnlyList<string> AuthorizationPolicies { get; init; }

Gets named authorization policies discovered for this endpoint.

property AuthorizationSource #

public EndpointAuthorizationSource AuthorizationSource { get; init; }

Gets the source of the authorization metadata.

property DefaultTimeout #

public TimeSpan DefaultTimeout { get; init; }

Gets the default timeout for this endpoint.

property HandlerType #

public Type? HandlerType { get; init; }

Gets the handler type that processes requests for this endpoint. This is used by the Microservice SDK for handler resolution. It is a process-local reference: it is not serialized (System.Text.Json does not serialize Type), so a HELLO or an endpoints update never carries it.

property Method #

public required string Method { get; init; }

Gets the HTTP method token as the endpoint configures it (GET, POST, PUT, PATCH, DELETE or another token), or EndpointDescriptor.AnyMethod.

property Path #

public required string Path { get; init; }

Gets the path template (e.g., “/billing/invoices/{id}”), with its letter case, its slashes and its catch-all, optional and default-value markers as configured.

property RequiresAuthentication #

public bool RequiresAuthentication { get; init; }

Gets a value indicating whether this endpoint requires an authenticated principal.

property RequiringClaims #

public IReadOnlyList<ClaimRequirement> RequiringClaims { get; init; }

Gets the claim requirements for authorization.

property Roles #

public IReadOnlyList<string> Roles { get; init; }

Gets role names required by endpoint metadata.

property SchemaInfo #

public EndpointSchemaInfo? SchemaInfo { get; init; }

Gets the schema information for this endpoint. Contains references to request/response schemas and OpenAPI documentation.

property ServiceName #

public required string ServiceName { get; init; }

Gets the name of the service that owns this endpoint.

property SupportsStreaming #

public bool SupportsStreaming { get; init; }

Gets a value indicating whether this endpoint supports streaming.

property UnmappedAuthorizationRequirements #

public IReadOnlyList<string> UnmappedAuthorizationRequirements { get; init; }

Gets the requirement type names the publishing service DECLARED and could not translate into a claim requirement — an AssertionRequirement from RequireAssertion(...), an unresolvable named policy, a custom requirement exposing no scope property.

Remarks

Diagnostic only: the gateway’s decision is driven by EndpointDescriptor.AuthorizationFullyMapped, so an old descriptor that carries neither field still fails closed. This list is what names the offending requirement in the refusal log.

property Version #

public required string Version { get; init; }

Gets the semantic version of the service.

record EndpointSchemaInfo

public sealed record EndpointSchemaInfo

Schema metadata for an endpoint, referencing schemas by ID.

Members

MemberKindSummary
EndpointSchemaInfo()constructorCreates an instance of EndpointSchemaInfo.
DeprecatedpropertyGets a value indicating whether this endpoint is deprecated.
DescriptionpropertyGets the OpenAPI operation description.
QueryParameterspropertyGets the query parameter descriptors for this endpoint.
RequestSchemaIdpropertyGets the schema ID for request validation.
ResponseSchemaIdpropertyGets the schema ID for response validation.
ResponseStatusCodepropertyGets the preferred success HTTP status code for the response schema.
SummarypropertyGets the OpenAPI operation summary.
TagspropertyGets the OpenAPI tags for this endpoint.

constructor EndpointSchemaInfo() #

public EndpointSchemaInfo()

Creates an instance of EndpointSchemaInfo.

property Deprecated #

public bool Deprecated { get; init; }

Gets a value indicating whether this endpoint is deprecated.

property Description #

public string? Description { get; init; }

Gets the OpenAPI operation description.

property QueryParameters #

public IReadOnlyList<QueryParameterInfo> QueryParameters { get; init; }

Gets the query parameter descriptors for this endpoint. Each entry contains the parameter name, JSON Schema type, and whether it is required. Propagated via HELLO and consumed by the gateway OpenAPI generator.

property RequestSchemaId #

public string? RequestSchemaId { get; init; }

Gets the schema ID for request validation. References a key in HelloPayload.Schemas.

property ResponseSchemaId #

public string? ResponseSchemaId { get; init; }

Gets the schema ID for response validation. References a key in HelloPayload.Schemas.

property ResponseStatusCode #

public int? ResponseStatusCode { get; init; }

Gets the preferred success HTTP status code for the response schema.

property Summary #

public string? Summary { get; init; }

Gets the OpenAPI operation summary.

property Tags #

public IReadOnlyList<string> Tags { get; init; }

Gets the OpenAPI tags for this endpoint.

record EndpointsUpdatePayload

public sealed record EndpointsUpdatePayload

Payload for the EndpointsUpdate frame sent by a microservice after the router requests a metadata replay.

Members

MemberKindSummary
EndpointsUpdatePayload()constructorCreates an instance of EndpointsUpdatePayload.
EndpointspropertyGets the endpoints registered by this instance.
OpenApiInfopropertyGets the OpenAPI metadata for this service.
SchemaspropertyGets the schema definitions for request/response validation.

constructor EndpointsUpdatePayload() #

public EndpointsUpdatePayload()

Creates an instance of EndpointsUpdatePayload.

property Endpoints #

public required IReadOnlyList<EndpointDescriptor> Endpoints { get; init; }

Gets the endpoints registered by this instance.

property OpenApiInfo #

public ServiceOpenApiInfo? OpenApiInfo { get; init; }

Gets the OpenAPI metadata for this service.

property Schemas #

public IReadOnlyDictionary<string, SchemaDefinition> Schemas { get; init; }

Gets the schema definitions for request/response validation. Keys are schema IDs referenced by EndpointDescriptor.SchemaInfo.

record Frame

public sealed record Frame

Represents a protocol frame in the router transport layer.

Members

MemberKindSummary
Frame()constructorCreates an instance of Frame.
CorrelationIdpropertyGets the correlation ID for request/response matching.
EnvelopeSealpropertyGets the gateway-issued envelope HMAC seal attached to this frame.
PayloadpropertyGets the raw payload bytes.
TypepropertyGets the type of this frame.

constructor Frame() #

public Frame()

Creates an instance of Frame.

property CorrelationId #

public string? CorrelationId { get; init; }

Gets the correlation ID for request/response matching.

property EnvelopeSeal #

public FrameEnvelopeSeal? EnvelopeSeal { get; init; }

Gets the gateway-issued envelope HMAC seal attached to this frame.

Remarks

Every frame leaving the gateway must carry a seal so that any transport — TCP, UDP, TLS, Messaging, RabbitMq, InMemory — can verify integrity at the application layer. Verifiers reject frames where this is null with rejection reason FrameEnvelopeRejectionReason.Missing.

property Payload #

public ReadOnlyMemory<byte> Payload { get; init; }

Gets the raw payload bytes.

property Type #

public required FrameType Type { get; init; }

Gets the type of this frame.

record HeartbeatPayload

public sealed record HeartbeatPayload

Payload for the Heartbeat frame sent periodically by microservices.

Members

MemberKindSummary
HeartbeatPayload()constructorCreates an instance of HeartbeatPayload.
ErrorRatepropertyGets the error rate (0.0 to 1.0).
InFlightRequestCountpropertyGets the current in-flight request count.
InstancepropertyGets the instance descriptor.
InstanceIdpropertyGets the instance ID.
StatuspropertyGets the health status.
TimestampUtcpropertyGets the timestamp when this heartbeat was created.
TransportCapabilitiespropertyGets transport-specific capabilities supported by this connection.

constructor HeartbeatPayload() #

public HeartbeatPayload()

Creates an instance of HeartbeatPayload.

property ErrorRate #

public double ErrorRate { get; init; }

Gets the error rate (0.0 to 1.0).

property InFlightRequestCount #

public int InFlightRequestCount { get; init; }

Gets the current in-flight request count.

property Instance #

public InstanceDescriptor? Instance { get; init; }

Gets the instance descriptor.

property InstanceId #

public required string InstanceId { get; init; }

Gets the instance ID.

property Status #

public required InstanceHealthStatus Status { get; init; }

Gets the health status.

property TimestampUtc #

public DateTime TimestampUtc { get; init; }

Gets the timestamp when this heartbeat was created.

property TransportCapabilities #

public IReadOnlyList<string> TransportCapabilities { get; init; }

Gets transport-specific capabilities supported by this connection. Heartbeats repeat capabilities so gateway state rebuilt after a restart does not lose rolling-upgrade delivery semantics.

record HelloPayload

public sealed record HelloPayload

Payload for the Hello frame sent by microservices on connection.

Members

MemberKindSummary
HelloPayload()constructorCreates an instance of HelloPayload.
EndpointspropertyGets the endpoints registered by this instance.
InstancepropertyGets the instance descriptor.
OpenApiInfopropertyGets the OpenAPI metadata for this service.
SchemaspropertyGets the schema definitions for request/response validation.
TransportCapabilitiespropertyGets transport-specific capabilities supported by this connection.

constructor HelloPayload() #

public HelloPayload()

Creates an instance of HelloPayload.

property Endpoints #

public required IReadOnlyList<EndpointDescriptor> Endpoints { get; init; }

Gets the endpoints registered by this instance.

property Instance #

public required InstanceDescriptor Instance { get; init; }

Gets the instance descriptor.

property OpenApiInfo #

public ServiceOpenApiInfo? OpenApiInfo { get; init; }

Gets the OpenAPI metadata for this service.

property Schemas #

public IReadOnlyDictionary<string, SchemaDefinition> Schemas { get; init; }

Gets the schema definitions for request/response validation. Keys are schema IDs referenced by EndpointDescriptor.SchemaInfo.

property TransportCapabilities #

public IReadOnlyList<string> TransportCapabilities { get; init; }

Gets transport-specific capabilities supported by this connection. Unknown values are ignored so mixed-version deployments remain compatible.

record InstanceDescriptor

public sealed record InstanceDescriptor

Describes a microservice instance’s identity.

Members

MemberKindSummary
InstanceDescriptor()constructorCreates an instance of InstanceDescriptor.
InstanceIdpropertyGets the unique identifier for this instance.
RegionpropertyGets the region where this instance is deployed.
ServiceNamepropertyGets the name of the service.
VersionpropertyGets the semantic version of the service.
WeightpropertyGets the routing weight used for intra-tier weighted canary selection.

constructor InstanceDescriptor() #

public InstanceDescriptor()

Creates an instance of InstanceDescriptor.

property InstanceId #

public required string InstanceId { get; init; }

Gets the unique identifier for this instance.

property Region #

public required string Region { get; init; }

Gets the region where this instance is deployed.

property ServiceName #

public required string ServiceName { get; init; }

Gets the name of the service.

property Version #

public required string Version { get; init; }

Gets the semantic version of the service.

property Weight #

public int Weight { get; init; }

Gets the routing weight used for intra-tier weighted canary selection.

class PayloadLimits

public sealed class PayloadLimits

Configuration for payload and memory limits.

Members

MemberKindSummary
PayloadLimits()constructorCreates an instance of PayloadLimits.
DefaultfieldDefault payload limits.
MaxAggregateInflightBytespropertyGets or sets the maximum aggregate in-flight bytes across all requests.
MaxRequestBytesPerCallpropertyGets or sets the maximum request bytes per call.
MaxRequestBytesPerConnectionpropertyGets or sets the maximum request bytes per connection.

constructor PayloadLimits() #

public PayloadLimits()

Creates an instance of PayloadLimits.

field Default #

public static readonly PayloadLimits Default

Default payload limits.

property MaxAggregateInflightBytes #

public long MaxAggregateInflightBytes { get; set; }

Gets or sets the maximum aggregate in-flight bytes across all requests. Default: 1 GB.

property MaxRequestBytesPerCall #

public long MaxRequestBytesPerCall { get; set; }

Gets or sets the maximum request bytes per call. Default: 10 MB.

property MaxRequestBytesPerConnection #

public long MaxRequestBytesPerConnection { get; set; }

Gets or sets the maximum request bytes per connection. Default: 100 MB.

record QueryParameterInfo

public sealed record QueryParameterInfo

Lightweight query parameter descriptor that can be serialized in the HELLO payload.

Members

MemberKindSummary
QueryParameterInfo()constructorCreates an instance of QueryParameterInfo.
DescriptionpropertyOptional description for OpenAPI documentation.
NamepropertyParameter name as it appears in the query string.
RequiredpropertyWhether the parameter is required.
TypepropertyJSON Schema type (string, integer, boolean, array, etc.).

constructor QueryParameterInfo() #

public QueryParameterInfo()

Creates an instance of QueryParameterInfo.

property Description #

public string? Description { get; init; }

Optional description for OpenAPI documentation.

property Name #

public required string Name { get; init; }

Parameter name as it appears in the query string.

property Required #

public bool Required { get; init; }

Whether the parameter is required.

property Type #

public string Type { get; init; }

JSON Schema type (string, integer, boolean, array, etc.).

record RegistrationResyncRequestPayload

public sealed record RegistrationResyncRequestPayload

Payload for the ResyncRequest frame sent by the router when it needs a fresh endpoint metadata replay.

Members

MemberKindSummary
RegistrationResyncRequestPayload()constructorCreates an instance of RegistrationResyncRequestPayload.
ReasonpropertyGets the reason for the replay request.

constructor RegistrationResyncRequestPayload() #

public RegistrationResyncRequestPayload()

Creates an instance of RegistrationResyncRequestPayload.

property Reason #

public string Reason { get; init; }

Gets the reason for the replay request.

class RouterTransportCapabilities

public static class RouterTransportCapabilities

Canonical capability identifiers advertised by router transport connections.

Members

MemberKindSummary
MessagingCancelControlV1constantThe messaging client consumes authenticated CANCEL frames from its connection-specific control queue independently of the request queue.

constant MessagingCancelControlV1 #

public const string MessagingCancelControlV1 = "messaging.cancel-control.v1"

The messaging client consumes authenticated CANCEL frames from its connection-specific control queue independently of the request queue.

record RoutingContext

public sealed record RoutingContext

Neutral routing context that does not depend on ASP.NET. Gateway will adapt from HttpContext to this neutral model.

Members

MemberKindSummary
RoutingContext()constructorCreates an instance of RoutingContext.
AvailableConnectionspropertyGets the available connections for routing.
CancellationTokenpropertyGets the cancellation token for the request.
EndpointpropertyGets the resolved endpoint descriptor.
GatewayRegionpropertyGets the gateway’s region for routing decisions.
HeaderspropertyGets the request headers.
MethodpropertyGets the HTTP method (GET, POST, PUT, PATCH, DELETE).
PathpropertyGets the request path.
RequestedVersionpropertyGets the requested version, if specified.
RouteDefaultTimeoutpropertyGets the gateway route default timeout selected for this request path.

constructor RoutingContext() #

public RoutingContext()

Creates an instance of RoutingContext.

property AvailableConnections #

public IReadOnlyList<ConnectionState> AvailableConnections { get; init; }

Gets the available connections for routing.

property CancellationToken #

public CancellationToken CancellationToken { get; init; }

Gets the cancellation token for the request.

property Endpoint #

public EndpointDescriptor? Endpoint { get; init; }

Gets the resolved endpoint descriptor.

property GatewayRegion #

public required string GatewayRegion { get; init; }

Gets the gateway’s region for routing decisions.

property Headers #

public IReadOnlyDictionary<string, string> Headers { get; init; }

Gets the request headers.

property Method #

public required string Method { get; init; }

Gets the HTTP method (GET, POST, PUT, PATCH, DELETE).

property Path #

public required string Path { get; init; }

Gets the request path.

property RequestedVersion #

public string? RequestedVersion { get; init; }

Gets the requested version, if specified.

property RouteDefaultTimeout #

public TimeSpan? RouteDefaultTimeout { get; init; }

Gets the gateway route default timeout selected for this request path.

record RoutingDecision

public sealed record RoutingDecision

Represents the outcome of a routing decision.

Members

MemberKindSummary
RoutingDecision()constructorCreates an instance of RoutingDecision.
ConnectionpropertyGets the selected connection.
EffectiveTimeoutpropertyGets the effective timeout for the request: the gateway answers the caller with 504 when it elapses.
EndpointpropertyGets the selected endpoint.
TransportTypepropertyGets the transport type to use.

constructor RoutingDecision() #

public RoutingDecision()

Creates an instance of RoutingDecision.

property Connection #

public required ConnectionState Connection { get; init; }

Gets the selected connection.

property EffectiveTimeout #

public required TimeSpan EffectiveTimeout { get; init; }

Gets the effective timeout for the request: the gateway answers the caller with 504 when it elapses.

Remarks

The request frame carries it to the microservice in whole seconds, rounded up and at least one second; the Messaging transport’s service side stops the request at that rounded-up timeout.

property Endpoint #

public required EndpointDescriptor Endpoint { get; init; }

Gets the selected endpoint.

property TransportType #

public required TransportType TransportType { get; init; }

Gets the transport type to use.

record SchemaDefinition

public sealed record SchemaDefinition

A JSON Schema definition for request or response validation.

Members

MemberKindSummary
SchemaDefinition()constructorCreates an instance of SchemaDefinition.
ETagpropertyGets the ETag for cache validation (SHA256 truncated).
SchemaIdpropertyGets the unique schema identifier (e.g., “CreateInvoiceRequest”).
SchemaJsonpropertyGets the JSON Schema document (draft 2020-12 compatible).

constructor SchemaDefinition() #

public SchemaDefinition()

Creates an instance of SchemaDefinition.

property ETag #

public string? ETag { get; init; }

Gets the ETag for cache validation (SHA256 truncated).

property SchemaId #

public required string SchemaId { get; init; }

Gets the unique schema identifier (e.g., “CreateInvoiceRequest”).

property SchemaJson #

public required string SchemaJson { get; init; }

Gets the JSON Schema document (draft 2020-12 compatible).

record ServiceOpenApiInfo

public sealed record ServiceOpenApiInfo

OpenAPI metadata for a microservice.

Members

MemberKindSummary
ServiceOpenApiInfo()constructorCreates an instance of ServiceOpenApiInfo.
ContactpropertyGets the contact information for the service.
DescriptionpropertyGets the service description for OpenAPI info.
LicensepropertyGets the license name for the service.
TitlepropertyGets the service title for OpenAPI info.

constructor ServiceOpenApiInfo() #

public ServiceOpenApiInfo()

Creates an instance of ServiceOpenApiInfo.

property Contact #

public string? Contact { get; init; }

Gets the contact information for the service.

property Description #

public string? Description { get; init; }

Gets the service description for OpenAPI info.

property License #

public string? License { get; init; }

Gets the license name for the service.

property Title #

public string? Title { get; init; }

Gets the service title for OpenAPI info.

record StreamDataPayload

public sealed record StreamDataPayload

Payload for streaming data frames (REQUEST_STREAM_DATA/RESPONSE_STREAM_DATA).

Members

MemberKindSummary
StreamDataPayload()constructorCreates an instance of StreamDataPayload.
CorrelationIdpropertyGets the correlation ID linking stream data to the original request.
DatapropertyGets the stream data chunk.
EndOfStreampropertyGets a value indicating whether this is the final chunk.
SequenceNumberpropertyGets the sequence number for ordering.

constructor StreamDataPayload() #

public StreamDataPayload()

Creates an instance of StreamDataPayload.

property CorrelationId #

public required Guid CorrelationId { get; init; }

Gets the correlation ID linking stream data to the original request.

property Data #

public byte[] Data { get; init; }

Gets the stream data chunk.

property EndOfStream #

public bool EndOfStream { get; init; }

Gets a value indicating whether this is the final chunk.

property SequenceNumber #

public int SequenceNumber { get; init; }

Gets the sequence number for ordering.

record StreamingOptions

public sealed record StreamingOptions

Configuration options for streaming operations.

Members

MemberKindSummary
StreamingOptions()constructorCreates an instance of StreamingOptions.
DefaultfieldGets the default streaming options.
ChannelCapacitypropertyGets the channel capacity for buffered stream data.
ChunkSizepropertyGets the size of each chunk when streaming data.
MaxConcurrentStreamspropertyGets the maximum number of concurrent streams per connection.
StreamIdleTimeoutpropertyGets the timeout for idle streams (no data flowing).

constructor StreamingOptions() #

public StreamingOptions()

Creates an instance of StreamingOptions.

field Default #

public static readonly StreamingOptions Default

Gets the default streaming options.

property ChannelCapacity #

public int ChannelCapacity { get; init; }

Gets the channel capacity for buffered stream data. Default: 16 chunks.

property ChunkSize #

public int ChunkSize { get; init; }

Gets the size of each chunk when streaming data. Default: 64 KB.

property MaxConcurrentStreams #

public int MaxConcurrentStreams { get; init; }

Gets the maximum number of concurrent streams per connection. Default: 100.

property StreamIdleTimeout #

public TimeSpan StreamIdleTimeout { get; init; }

Gets the timeout for idle streams (no data flowing). Default: 5 minutes.

class TransportDefaultPorts

public static class TransportDefaultPorts

The default ports of the connection transports. The gateway’s listener options and the transports’ own options (which the transport plugins bind from the same configuration section) take their defaults from here, so a listener configured without a port uses the port the gateway’s options describe.

Members

MemberKindSummary
TcpconstantThe TCP transport’s default port.
TlsconstantThe TLS transport’s default port.
UdpconstantThe UDP transport’s default port.

constant Tcp #

public const int Tcp = 9100

The TCP transport’s default port.

constant Tls #

public const int Tls = 9443

The TLS transport’s default port.

constant Udp #

public const int Udp = 5102

The UDP transport’s default port.

namespace StellaOps.Router.Common.Plugins

TypeKindDescription
IRouterTransportPlugininterfacePlugin contract for router transport implementations.
RouterTransportConfigurationBinderclassBinding helpers for transport option values the configuration binder cannot convert.
RouterTransportModeenumTransport mode flags indicating whether to register server, client, or both capabilities.
RouterTransportPluginLoaderclassLoads and discovers router transport plugins from assemblies the host passes in (RouterTransportPluginLoader.LoadFromAssembly(Assembly)).
RouterTransportRegistrationContextclassContext provided to transport plugins during registration.

interface IRouterTransportPlugin

public interface IRouterTransportPlugin

Plugin contract for router transport implementations. A plugin provides one side of a transport (IRouterTransportPlugin.Mode): the client side that a microservice uses to connect, the server side that a gateway listens with, or both for an in-process transport. A network transport ships its client side in StellaOps.Router.Transport.<Name> and its server side in StellaOps.Router.Transport.<Name>.Server; both plugins carry the same IRouterTransportPlugin.TransportName, and RouterTransportPluginLoaderkeys plugins by name and mode.

Members

MemberKindSummary
DisplayNamepropertyGets the human-readable display name for this transport.
ModepropertyGets the side of the transport this plugin registers: RouterTransportMode.Client, RouterTransportMode.Server, or RouterTransportMode.Both.
TransportNamepropertyGets the transport name (e.g., “tcp”, “tls”, “udp”, “rabbitmq”, “inmemory”, “messaging”), shared by the client and the server plugin of one transport.
Register(RouterTransportRegistrationContext)methodRegisters transport services into the DI container for the side the context asks for.

property DisplayName #

string DisplayName { get; }

Gets the human-readable display name for this transport.

property Mode #

RouterTransportMode Mode { get; }

Gets the side of the transport this plugin registers: RouterTransportMode.Client, RouterTransportMode.Server, or RouterTransportMode.Both. IRouterTransportPlugin.Register(RouterTransportRegistrationContext)refuses a context that asks for a side outside this value (RouterTransportRegistrationContext.EnsureSupportedBy(IRouterTransportPlugin)).

property TransportName #

string TransportName { get; }

Gets the transport name (e.g., “tcp”, “tls”, “udp”, “rabbitmq”, “inmemory”, “messaging”), shared by the client and the server plugin of one transport.

method Register(RouterTransportRegistrationContext) #

void Register(RouterTransportRegistrationContext context)

Registers transport services into the DI container for the side the context asks for.

Parameters

  • context: The registration context containing services, configuration, and transport mode.

Exceptions

  • InvalidOperationException: The context asks for a side this plugin does not provide.

class RouterTransportConfigurationBinder

public static class RouterTransportConfigurationBinder

Binding helpers for transport option values the configuration binder cannot convert.

Members

MemberKindSummary
BindIPAddress(IConfigurationSection, string, Action<IPAddress>)methodReads an IP address setting.

method BindIPAddress(IConfigurationSection, string, Action<IPAddress>) #

public static void BindIPAddress(IConfigurationSection section, string key, Action<IPAddress> apply)

Reads an IP address setting. The configuration binder has no converter from a string to IPAddress and leaves the default in place without an error, so a configured BindAddress such as 127.0.0.1 was ignored and the listener bound every interface. An absent or empty value keeps the default; a value that is not an IP address fails closed.

Parameters

  • section: The transport’s configuration section.
  • key: The setting name, for example BindAddress.
  • apply: Receives the parsed address.

Exceptions

  • InvalidOperationException: The value is not an IP address.

enum RouterTransportMode

public enum RouterTransportMode

Transport mode flags indicating whether to register server, client, or both capabilities.

ValueDescription
None = 0No transport registration.
Server = 1Register server-side transport (listening for connections).
Client = 2Register client-side transport (connecting to remote services).
Both = 3Register both server and client transport capabilities.

class RouterTransportPluginLoader

public sealed class RouterTransportPluginLoader

Loads and discovers router transport plugins from assemblies the host passes in (RouterTransportPluginLoader.LoadFromAssembly(Assembly)).

Remarks

AppDomain-resident transports loaded by the build system live inside the gateway image, which is signed at build time (Authenticode on Windows, signed RPM/DEB on Linux), and so do not need a directory-level trust pipeline.

This library loads nothing from disk. Stella Ops hosts load a transport directory with a signed transports.signed.json manifest through RouterTransportSignedManifestLoader.LoadFromSignedManifestDirectoryAsync in StellaOps.Router.Plugins, which verifies the directory and then passes each admitted assembly to RouterTransportPluginLoader.LoadFromAssembly(Assembly).

Members

MemberKindSummary
RouterTransportPluginLoader()constructorCreates an instance of RouterTransportPluginLoader.
RouterTransportPluginLoader(ILogger<RouterTransportPluginLoader>)constructorCreates a loader.
PluginspropertyGets all loaded transport plugins.
DescribeLoadOutcome()methodDescribes what this loader holds, for the startup error a host raises when no plugin provides a transport: the loaded plugins with their sides, and each assembly whose types failed to load with its distinct load errors (for example a plugin built against an older IRouterTransportPlugin: "Method ‘get_Mode’ …
GetPlugin(string, RouterTransportMode)methodGets the loaded plugin that provides mode for a transport name (case-insensitive): the client plugin for RouterTransportMode.Client, the server plugin for RouterTransportMode.Server.
LoadFromAssembly(Assembly)methodLoads transport plugins from the specified assembly.
RecordLoadFailure(string, Exception)methodRecords an assembly the host could not hand to RouterTransportPluginLoader.LoadFromAssembly(Assembly), for example a signed transport file whose Assembly.LoadFrom failed.

constructor RouterTransportPluginLoader() #

public RouterTransportPluginLoader()

Creates an instance of RouterTransportPluginLoader.

constructor RouterTransportPluginLoader(ILogger<RouterTransportPluginLoader>) #

public RouterTransportPluginLoader(ILogger<RouterTransportPluginLoader>? logger = null)

Creates a loader.

Parameters

  • logger: Receives the load diagnostics; none when not set.

property Plugins #

public IReadOnlyList<IRouterTransportPlugin> Plugins { get; }

Gets all loaded transport plugins.

method DescribeLoadOutcome() #

public string DescribeLoadOutcome()

Describes what this loader holds, for the startup error a host raises when no plugin provides a transport: the loaded plugins with their sides, and each assembly whose types failed to load with its distinct load errors (for example a plugin built against an older IRouterTransportPlugin: “Method ‘get_Mode’ … does not have an implementation”). Assemblies are named by file name; rooted paths inside the runtime’s messages (quoted, or as a whole word) are reduced to file names.

Returns

One sentence for plugins and one for load failures.

method GetPlugin(string, RouterTransportMode) #

public IRouterTransportPlugin? GetPlugin(string transportName, RouterTransportMode mode)

Gets the loaded plugin that provides mode for a transport name (case-insensitive): the client plugin for RouterTransportMode.Client, the server plugin for RouterTransportMode.Server. RouterTransportMode.Bothfinds only a plugin that provides both sides (an in-process transport).

Parameters

  • transportName: The transport name.
  • mode: The side the caller registers.

Returns

The plugin, or null when no loaded plugin provides that side.

method LoadFromAssembly(Assembly) #

public void LoadFromAssembly(Assembly assembly)

Loads transport plugins from the specified assembly. Used for AppDomain-resident transports that ship inside the gateway image (the gateway image is the trust boundary for these).

Parameters

  • assembly: The assembly to scan for IRouterTransportPlugin implementations.

method RecordLoadFailure(string, Exception) #

public void RecordLoadFailure(string assemblyFile, Exception exception)

Records an assembly the host could not hand to RouterTransportPluginLoader.LoadFromAssembly(Assembly), for example a signed transport file whose Assembly.LoadFrom failed. RouterTransportPluginLoader.DescribeLoadOutcome()reports it with the file name only.

Parameters

  • assemblyFile: The assembly file name or path; only the file name is kept.
  • exception: The load error.

class RouterTransportRegistrationContext

public sealed class RouterTransportRegistrationContext

Context provided to transport plugins during registration.

Members

MemberKindSummary
RouterTransportRegistrationContext(IServiceCollection, IConfiguration, RouterTransportMode)constructorCreates a new registration context.
ConfigurationpropertyGets the configuration root.
ConfigurationSectionpropertyGets or sets the configuration section path for this transport (e.g., “Router:Transports:Tcp”).
ModepropertyGets the transport mode (server, client, or both).
ServicespropertyGets the service collection for registering services.
EnsureSupportedBy(IRouterTransportPlugin)methodThrows when RouterTransportRegistrationContext.Modeasks for a side of the transport that plugin does not provide.

constructor RouterTransportRegistrationContext(IServiceCollection, IConfiguration, RouterTransportMode) #

public RouterTransportRegistrationContext(IServiceCollection services, IConfiguration configuration, RouterTransportMode mode)

Creates a new registration context.

Parameters

  • services: The service collection for registering services.
  • configuration: The configuration root.
  • mode: The transport mode (server, client, or both).

property Configuration #

public IConfiguration Configuration { get; }

Gets the configuration root.

property ConfigurationSection #

public string? ConfigurationSection { get; init; }

Gets or sets the configuration section path for this transport (e.g., “Router:Transports:Tcp”).

property Mode #

public RouterTransportMode Mode { get; }

Gets the transport mode (server, client, or both).

property Services #

public IServiceCollection Services { get; }

Gets the service collection for registering services.

method EnsureSupportedBy(IRouterTransportPlugin) #

public void EnsureSupportedBy(IRouterTransportPlugin plugin)

Throws when RouterTransportRegistrationContext.Modeasks for a side of the transport that plugin does not provide. A network transport’s client plugin registers the client side only; its server side is a separate plugin in StellaOps.Router.Transport.<Name>.Server.

Parameters

  • plugin: The plugin about to register.

Exceptions

  • InvalidOperationException: The context asks for a side the plugin does not provide.