StellaOps.Router.Gateway.Hosting

Router gateway host: transport hosting, endpoint claims authorization, health and the router administration endpoints.

library
Component
Router
Licence
BUSL-1.1 (Router licence)
Target framework
net10.0
Latest release
1.0.1-20261117T070237Z

Install

dotnet add package StellaOps.Router.Gateway.Hosting --version 1.0.1-20261117T070237Z

Namespaces

NamespaceTypes
StellaOps.Router.Gateway.Hosting2
StellaOps.Router.Gateway.Hosting.Authorization3
StellaOps.Router.Gateway.Hosting.Configuration13
StellaOps.Router.Gateway.Hosting.Endpoints4
StellaOps.Router.Gateway.Hosting.Licensing11
StellaOps.Router.Gateway.Hosting.Middleware4
StellaOps.Router.Gateway.Hosting.Routing1
StellaOps.Router.Gateway.Hosting.Services12

namespace StellaOps.Router.Gateway.Hosting

TypeKindDescription
GatewayPipelineExtensionsclassThe parts of the gateway composition that every gateway host shares: the request pipeline that resolves, authorizes and dispatches a request to a microservice, and the mapping of the Gateway configuration section onto the router library options.
RouterGatewayHostExtensionsclassComposes a router gateway host that needs no other Stella Ops service.

class GatewayPipelineExtensions

public static class GatewayPipelineExtensions

The parts of the gateway composition that every gateway host shares: the request pipeline that resolves, authorizes and dispatches a request to a microservice, and the mapping of the Gateway configuration section onto the router library options. Both StellaOps.Gateway.WebService and RouterGatewayHostExtensionscall these, so the two hosts run one pipeline.

Members

MemberKindSummary
AddGatewayOptionsMapping(IServiceCollection)extension methodMaps the bound GatewayOptionsonto the router library options (RouterNodeConfig, RoutingOptions, PayloadLimits, HealthOptionsand OpenApiAggregationOptions).
UseGatewayRequestPipeline(IApplicationBuilder)extension methodAdds the request pipeline for a request that the host does not answer itself: request logging, error handling, payload limits, endpoint resolution from the routing state, the endpoint claims check (AuthorizationMiddleware), rate limiting, the routing decision and the transport dispatch.

extension method AddGatewayOptionsMapping(IServiceCollection) #

public static IServiceCollection AddGatewayOptionsMapping(this IServiceCollection services)

Maps the bound GatewayOptionsonto the router library options (RouterNodeConfig, RoutingOptions, PayloadLimits, HealthOptionsand OpenApiAggregationOptions).

Parameters

  • services: The service collection.

Returns

The service collection for chaining.

extension method UseGatewayRequestPipeline(IApplicationBuilder) #

public static IApplicationBuilder UseGatewayRequestPipeline(this IApplicationBuilder app)

Adds the request pipeline for a request that the host does not answer itself: request logging, error handling, payload limits, endpoint resolution from the routing state, the endpoint claims check (AuthorizationMiddleware), rate limiting, the routing decision and the transport dispatch.

Parameters

  • app: The application builder of the routing branch.

Returns

The application builder for chaining.

class RouterGatewayHostExtensions

public static class RouterGatewayHostExtensions

Composes a router gateway host that needs no other Stella Ops service. It runs the gateway pipeline (transport hosting, endpoint claims authorization, health, the router administration endpoints) and authenticates callers with standard JWT bearer tokens from any OpenID Connect issuer. It uses Valkey only when rate-limit rules or the Messaging transport are configured to use it, and it needs no crypto provider beyond the built-in default.

Remarks

Transports come from signed bundles and from assemblies deployed with the host. Signed bundles are the runtime-bundle.v2 bundles under Gateway:TransportPlugins:Directory, admitted by StellaOps.Plugin against the RS256 and ES256 public keys of the local trust-root directory Gateway:TransportPlugins:TrustRootDirectory; a refused bundle stops the host. They load first, so a transport side a bundle provides is used instead of one built into the host. Then come the assemblies the host passes to RouterGatewayHostExtensions.AddRouterGatewayHost(WebApplicationBuilder, params Assembly[]), every assembly named under Gateway:TransportPlugins:ImageResidentAssemblies, and every StellaOps.Router.Transport.* assembly already loaded into the default load context. The gateway registers the server side of each enabled transport, so the assemblies it needs are the StellaOps.Router.Transport.<Name>.Server ones; the in-process transport provides both sides in one assembly. The X.509-signed transport folders of the Stella Ops gateway (transports.signed.json) are not read here.

The composition includes the Router licence monitor (StellaOps:ComponentLicence): every host built with RouterGatewayHostExtensions.AddRouterGatewayHost(WebApplicationBuilder, params Assembly[])reports its licence status, registered after the transport host so it sees the connected microservices.

Settings that this host does not read (see RouterGatewayHostExtensions.PlatformOnlySections) stop the host at startup instead of being ignored.

Hosted services start in registration order. A hosted service registered after RouterGatewayHostExtensions.AddRouterGatewayHost(WebApplicationBuilder, params Assembly[])starts after the transport host, so it sees the routing state that the connected microservices populate.

Members

MemberKindSummary
IdentityEnvelopeSigningKeyKeyconstantThe configuration key of the shared key that signs the identity envelope of every authenticated request routed to a microservice; the microservices verify the envelope with the same key (ASP.NET Core bridge: StellaRouterBridgeOptions.IdentityEnvelopeSigningKey).
ImageResidentTransportAssembliesKeyconstantThe configuration key that lists transport assemblies to load at startup.
JwtBearerSectionNameconstantThe configuration section that the ASP.NET Core JWT bearer handler reads (Authority, MetadataAddress, RequireHttpsMetadata, ValidIssuer(s), ValidAudience(s), SigningKeys, MapInboundClaims).
PlatformOnlySectionsfieldConfiguration that only the Stella Ops gateway host reads.
AddRouterGatewayHost(WebApplicationBuilder, params Assembly[])extension methodRegisters the gateway services, the enabled transports, JWT bearer authentication and the authorization policies of the router administration endpoints.
UseRouterGatewayHost(WebApplication)extension methodAdds the gateway middleware and endpoints: authentication, health (/health, /health/live, /health/ready, /health/startup) and /metrics, the router administration endpoints, the generated OpenAPI document when Gateway:OpenApi:Enabled is true, and the routing pipeline for every other request.

constant IdentityEnvelopeSigningKeyKey #

public const string IdentityEnvelopeSigningKeyKey = "Gateway:IdentityEnvelope:SigningKey"

The configuration key of the shared key that signs the identity envelope of every authenticated request routed to a microservice; the microservices verify the envelope with the same key (ASP.NET Core bridge: StellaRouterBridgeOptions.IdentityEnvelopeSigningKey). Optional: without it the gateway sends no caller identity. When set, at least 32 characters.

constant ImageResidentTransportAssembliesKey #

public const string ImageResidentTransportAssembliesKey = "Gateway:TransportPlugins:ImageResidentAssemblies"

The configuration key that lists transport assemblies to load at startup.

constant JwtBearerSectionName #

public const string JwtBearerSectionName = "Authentication:Schemes:Bearer"

The configuration section that the ASP.NET Core JWT bearer handler reads (Authority, MetadataAddress, RequireHttpsMetadata, ValidIssuer(s), ValidAudience(s), SigningKeys, MapInboundClaims).

field PlatformOnlySections #

public static readonly IReadOnlyList<string> PlatformOnlySections

Configuration that only the Stella Ops gateway host reads. A host built with RouterGatewayHostExtensions.AddRouterGatewayHost(WebApplicationBuilder, params Assembly[])refuses to start while any of these is present.

extension method AddRouterGatewayHost(WebApplicationBuilder, params Assembly[]) #

public static WebApplicationBuilder AddRouterGatewayHost(this WebApplicationBuilder builder, params Assembly[] transportAssemblies)

Registers the gateway services, the enabled transports, JWT bearer authentication and the authorization policies of the router administration endpoints.

Parameters

  • builder: The web application builder.
  • transportAssemblies: Assemblies that carry the server-side transport plugins the host offers, for example typeof(TcpTransportServerPlugin).Assembly (StellaOps.Router.Transport.Tcp.Server). A transport is registered only when its Gateway:Transports:<name>:Enabled setting is true.

Returns

The builder for chaining.

Exceptions

  • InvalidOperationException: A Stella Ops-only setting is present, JWT bearer authentication is not configured, a signed transport bundle is refused, a listed transport assembly cannot be loaded, or an enabled transport has no plugin.

extension method UseRouterGatewayHost(WebApplication) #

public static WebApplication UseRouterGatewayHost(this WebApplication app)

Adds the gateway middleware and endpoints: authentication, health (/health, /health/live, /health/ready, /health/startup) and /metrics, the router administration endpoints, the generated OpenAPI document when Gateway:OpenApi:Enabled is true, and the routing pipeline for every other request. A request routed to a microservice loses every identity header the client sent (X-StellaOps-Actor, X-StellaOps-Scopes, the identity envelope headers and the others the Stella Ops gateway reserves); an authenticated caller’s identity travels only in the identity envelope signed with RouterGatewayHostExtensions.IdentityEnvelopeSigningKeyKey.

Parameters

  • app: The web application.

Returns

The application for chaining.

namespace StellaOps.Router.Gateway.Hosting.Authorization

TypeKindDescription
AuthorizationMiddlewareclassEnforces the claim requirements of the endpoint a request is routed to.
EffectiveClaimsStoreclassThe process-local store of the effective claim requirements: those the microservices announce and those an authority overrides.
IEffectiveClaimsStoreinterfaceThe effective claim requirements of the endpoints, with the claims of sibling methods on the same path.

class AuthorizationMiddleware

public sealed class AuthorizationMiddleware

Enforces the claim requirements of the endpoint a request is routed to.

Members

MemberKindSummary
AuthorizationMiddleware(RequestDelegate, IEffectiveClaimsStore, ILogger<AuthorizationMiddleware>)constructorCreates the middleware.
InvokeAsync(HttpContext)methodChecks the caller against the endpoint the request was routed to: answers 401 when the endpoint requires an authenticated caller and the caller is anonymous, and 403 when a required claim is missing; a request without a resolved endpoint or to an anonymous endpoint passes.

constructor AuthorizationMiddleware(RequestDelegate, IEffectiveClaimsStore, ILogger<AuthorizationMiddleware>) #

public AuthorizationMiddleware(RequestDelegate next, IEffectiveClaimsStore claimsStore, ILogger<AuthorizationMiddleware> logger)

Creates the middleware.

Parameters

  • next: The next middleware.
  • claimsStore: The effective claim requirements of the endpoints.
  • logger: Receives the diagnostics.

method InvokeAsync(HttpContext) #

public Task InvokeAsync(HttpContext context)

Checks the caller against the endpoint the request was routed to: answers 401 when the endpoint requires an authenticated caller and the caller is anonymous, and 403 when a required claim is missing; a request without a resolved endpoint or to an anonymous endpoint passes.

Parameters

  • context: The HTTP context.

Returns

A task that completes when the request is handled.

class EffectiveClaimsStore

public sealed class EffectiveClaimsStore : IEffectiveClaimsStore

The process-local store of the effective claim requirements: those the microservices announce and those an authority overrides.

Members

MemberKindSummary
EffectiveClaimsStore(ILogger<EffectiveClaimsStore>)constructorCreates an empty store.
GetEffectiveClaims(string, string, string, string)methodGets the effective claims for an endpoint of one version of a service.
GetSiblingMethodClaims(string, string, string, string)methodReturns the effective claim requirements registered for sibling HTTP methods on the same service + path template.
RemoveService(string, string)methodRemoves the claims of one version of a service.
UpdateFromAuthority(IReadOnlyDictionary<EndpointKey, IReadOnlyList<ClaimRequirement>>)methodUpdates claims from Authority overrides.
UpdateFromMicroservice(string, string, IReadOnlyList<EndpointDescriptor>)methodUpdates the claims of one version of a service from its HELLO message; other versions keep theirs.

constructor EffectiveClaimsStore(ILogger<EffectiveClaimsStore>) #

public EffectiveClaimsStore(ILogger<EffectiveClaimsStore> logger)

Creates an empty store.

Parameters

  • logger: Receives the diagnostics.

method GetEffectiveClaims(string, string, string, string) #

public IReadOnlyList<ClaimRequirement> GetEffectiveClaims(string serviceName, string version, string method, string path)

Gets the effective claims for an endpoint of one version of a service. Authority overrides (which name no version) take precedence over the version’s own claims.

Parameters

  • serviceName: The service name.
  • version: The service version whose claims apply.
  • method: The HTTP method.
  • path: The path template.

Returns

The effective claims for the endpoint.

method GetSiblingMethodClaims(string, string, string, string) #

public IReadOnlyList<ClaimRequirement> GetSiblingMethodClaims(string serviceName, string version, string path, string excludeMethod)

Returns the effective claim requirements registered for sibling HTTP methods on the same service + path template. Used to close asymmetric scope enforcement gaps where a state-changing method (POST/PUT/PATCH/DELETE) ships no claim requirements of its own but a sibling method (e.g. GET) is scope-protected. The result is the union of distinct claim requirements across all sibling methods except excludeMethod.

Parameters

  • serviceName: The service name.
  • version: The service version whose sibling methods count.
  • path: The path template.
  • excludeMethod: The method to exclude (the request’s own method).

Returns

The union of sibling-method claim requirements (possibly empty).

method RemoveService(string, string) #

public void RemoveService(string serviceName, string version)

Removes the claims of one version of a service. Called when the last instance of that version disconnects.

Parameters

  • serviceName: The service name.
  • version: The service version.

method UpdateFromAuthority(IReadOnlyDictionary<EndpointKey, IReadOnlyList<ClaimRequirement>>) #

public void UpdateFromAuthority(IReadOnlyDictionary<EndpointKey, IReadOnlyList<ClaimRequirement>> overrides)

Updates claims from Authority overrides.

Parameters

  • overrides: The Authority claims overrides.

method UpdateFromMicroservice(string, string, IReadOnlyList<EndpointDescriptor>) #

public void UpdateFromMicroservice(string serviceName, string version, IReadOnlyList<EndpointDescriptor> endpoints)

Updates the claims of one version of a service from its HELLO message; other versions keep theirs.

Parameters

  • serviceName: The service name.
  • version: The version of the instance that sent the HELLO.
  • endpoints: The endpoint descriptors with claims.

interface IEffectiveClaimsStore

public interface IEffectiveClaimsStore : IEffectiveClaimsStore

The effective claim requirements of the endpoints, with the claims of sibling methods on the same path.

Members

MemberKindSummary
GetSiblingMethodClaims(string, string, string, string)methodReturns the effective claim requirements registered for sibling HTTP methods on the same service + path template.

method GetSiblingMethodClaims(string, string, string, string) #

IReadOnlyList<ClaimRequirement> GetSiblingMethodClaims(string serviceName, string version, string path, string excludeMethod)

Returns the effective claim requirements registered for sibling HTTP methods on the same service + path template. Used to close asymmetric scope enforcement gaps where a state-changing method (POST/PUT/PATCH/DELETE) ships no claim requirements of its own but a sibling method (e.g. GET) is scope-protected. The result is the union of distinct claim requirements across all sibling methods except excludeMethod.

Parameters

  • serviceName: The service name.
  • version: The service version whose sibling methods count.
  • path: The path template.
  • excludeMethod: The method to exclude (the request’s own method).

Returns

The union of sibling-method claim requirements (possibly empty).

namespace StellaOps.Router.Gateway.Hosting.Configuration

TypeKindDescription
GatewayHealthOptionsclassWhen a connected instance counts as degraded or stale, how often the gateway checks, and which services readiness requires (Gateway:Health).
GatewayMessagingTransportOptionsclassThe Messaging transport section.
GatewayNodeOptionsclassThe identity of this gateway node (Gateway:Node), copied into the router node configuration.
GatewayOpenApiOptionsclassThe OpenAPI document the gateway generates from the connected microservices (OpenApiAggregationOptions).
GatewayOptionsclassThe Gateway section that the router gateway pipeline reads: node identity, transports, routing, OpenAPI and health.
GatewayOptionsValidatorclassValidates the GatewayOptionsof the router gateway pipeline at startup.
GatewayRabbitMqTransportOptionsclassRabbitMQ consumer for microservices.
GatewayRoutingOptionsclassHow the gateway routes a request (Gateway:Routing).
GatewayTcpTransportOptionsclassTCP listener for microservices (Gateway:Transports:Tcp).
GatewayTlsTransportOptionsclassTLS listener for microservices (Gateway:Transports:Tls).
GatewayTransportOptionsclassThe transport listeners of the gateway (Gateway:Transports).
GatewayUdpTransportOptionsclassUDP listener for microservices.
GatewayValueParserclassParses the duration and size strings of the gateway configuration, for example 30s and 100MB.

class GatewayHealthOptions

public sealed class GatewayHealthOptions

When a connected instance counts as degraded or stale, how often the gateway checks, and which services readiness requires (Gateway:Health). A duration is a TimeSpan string or a number with the unit ms, s, m or h (for example 30s); a number without a unit is seconds. The gateway raises the degraded threshold to at least twice, and the stale threshold to at least three times, the Messaging heartbeat interval.

Members

MemberKindSummary
GatewayHealthOptions()constructorCreates an instance of GatewayHealthOptions.
CheckIntervalpropertyHow often the gateway checks the instances for missed heartbeats.
DegradedThresholdpropertyThe time without a heartbeat after which an instance is degraded.
RequiredMicroservicespropertyThe services that must each have a healthy or degraded instance connected before the gateway reports ready.
ServiceNameSuffixespropertyEndings removed, each once and in this order, from a required service name and from a connected instance’s service name before readiness compares them (for example a DNS domain such as .example.internal).
StaleThresholdpropertyThe time without a heartbeat after which an instance is stale.

constructor GatewayHealthOptions() #

public GatewayHealthOptions()

Creates an instance of GatewayHealthOptions.

property CheckInterval #

public string CheckInterval { get; set; }

How often the gateway checks the instances for missed heartbeats. The default is 5s.

property DegradedThreshold #

public string DegradedThreshold { get; set; }

The time without a heartbeat after which an instance is degraded. The default is 15s; with the default Messaging heartbeat interval of 10 seconds, the minimum raises it to 20 seconds.

property RequiredMicroservices #

public List<string> RequiredMicroservices { get; set; }

The services that must each have a healthy or degraded instance connected before the gateway reports ready. Empty by default.

property ServiceNameSuffixes #

public List<string> ServiceNameSuffixes { get; set; }

Endings removed, each once and in this order, from a required service name and from a connected instance’s service name before readiness compares them (for example a DNS domain such as .example.internal). Empty by default: the names are compared as they are, ignoring case and a :port part.

property StaleThreshold #

public string StaleThreshold { get; set; }

The time without a heartbeat after which an instance is stale. The default is 30s.

class GatewayMessagingTransportOptions

public sealed class GatewayMessagingTransportOptions

The Messaging transport section. The messaging backend the host registers for the section binds its own subsection, named after the backend (for example valkey:ConnectionString), and transport names that backend; this class carries the queue settings both sides share.

Members

MemberKindSummary
GatewayMessagingTransportOptions()constructorCreates an instance of GatewayMessagingTransportOptions.
BatchSizepropertyBatch size for leasing messages.
CancelControlApproximateMaxLengthpropertyApproximate maximum entries retained by one cancellation control stream.
CancelControlBatchSizepropertyBatch size for the independent cancellation-control lane.
CancelControlQueueTemplatepropertyPer-connection queue template for cancellation control traffic.
CancelTombstoneTtlpropertyLifetime of cancel-before-request tombstones.
ConsumerGrouppropertyConsumer group name for request processing.
EnabledpropertyWhether the Messaging transport is enabled.
GatewayControlQueueServiceNamepropertyReserved queue segment used for gateway control traffic.
HeartbeatIntervalpropertyHeartbeat interval.
LeaseDurationpropertyLease duration for message processing.
MaxConcurrentRequestspropertyMaximum request handlers held concurrently by one messaging client.
MaxPendingCancellationspropertyMaximum pending cancellation tombstones per messaging client.
RequestQueueTemplatepropertyQueue name template for incoming requests.
RequestTimeoutpropertyTimeout for RPC requests.
ResponseQueueNamepropertyQueue name for gateway responses.

constructor GatewayMessagingTransportOptions() #

public GatewayMessagingTransportOptions()

Creates an instance of GatewayMessagingTransportOptions.

property BatchSize #

public int BatchSize { get; set; }

Batch size for leasing messages.

property CancelControlApproximateMaxLength #

public int CancelControlApproximateMaxLength { get; set; }

Approximate maximum entries retained by one cancellation control stream.

property CancelControlBatchSize #

public int CancelControlBatchSize { get; set; }

Batch size for the independent cancellation-control lane.

property CancelControlQueueTemplate #

public string CancelControlQueueTemplate { get; set; }

Per-connection queue template for cancellation control traffic.

property CancelTombstoneTtl #

public string CancelTombstoneTtl { get; set; }

Lifetime of cancel-before-request tombstones.

property ConsumerGroup #

public string ConsumerGroup { get; set; }

Consumer group name for request processing.

property Enabled #

public bool Enabled { get; set; }

Whether the Messaging transport is enabled.

property GatewayControlQueueServiceName #

public string GatewayControlQueueServiceName { get; set; }

Reserved queue segment used for gateway control traffic. Must not overlap with a real microservice name.

property HeartbeatInterval #

public string HeartbeatInterval { get; set; }

Heartbeat interval.

property LeaseDuration #

public string LeaseDuration { get; set; }

Lease duration for message processing.

property MaxConcurrentRequests #

public int MaxConcurrentRequests { get; set; }

Maximum request handlers held concurrently by one messaging client.

property MaxPendingCancellations #

public int MaxPendingCancellations { get; set; }

Maximum pending cancellation tombstones per messaging client.

property RequestQueueTemplate #

public string RequestQueueTemplate { get; set; }

Queue name template for incoming requests. Use {service} placeholder.

property RequestTimeout #

public string RequestTimeout { get; set; }

Timeout for RPC requests.

property ResponseQueueName #

public string ResponseQueueName { get; set; }

Queue name for gateway responses.

class GatewayNodeOptions

public sealed class GatewayNodeOptions

The identity of this gateway node (Gateway:Node), copied into the router node configuration.

Members

MemberKindSummary
GatewayNodeOptions()constructorCreates an instance of GatewayNodeOptions.
EnvironmentpropertyThe environment name of this node, for example prod or staging.
NeighborRegionspropertyThe regions to fall back to, in order of preference, when no instance of the local region can serve a request.
NodeIdpropertyThe unique identifier of this gateway node, for example gw-eu1-01.
RegionpropertyThe region this gateway serves.

constructor GatewayNodeOptions() #

public GatewayNodeOptions()

Creates an instance of GatewayNodeOptions.

property Environment #

public string Environment { get; set; }

The environment name of this node, for example prod or staging. The default is dev.

property NeighborRegions #

public List<string> NeighborRegions { get; set; }

The regions to fall back to, in order of preference, when no instance of the local region can serve a request.

property NodeId #

public string NodeId { get; set; }

The unique identifier of this gateway node, for example gw-eu1-01.

property Region #

public string Region { get; set; }

The region this gateway serves. Required; the default is local. With GatewayRoutingOptions.PreferLocalRegionset, instances of this region are preferred.

class GatewayOpenApiOptions

public sealed class GatewayOpenApiOptions

The OpenAPI document the gateway generates from the connected microservices (OpenApiAggregationOptions).

Members

MemberKindSummary
GatewayOpenApiOptions()constructorCreates an instance of GatewayOpenApiOptions.
CacheTtlSecondspropertyHow long the aggregated document is cached, in seconds.
DescriptionpropertyThe description of the document.
EnabledpropertyWhether the gateway serves the aggregated OpenAPI document.
ServerUrlpropertyThe server URL the document declares.
TitlepropertyThe title of the document.
TokenUrlpropertyThe OAuth2 token URL of the client-credentials flow the endpoint scopes are obtained from.
VersionpropertyThe version of the document.

constructor GatewayOpenApiOptions() #

public GatewayOpenApiOptions()

Creates an instance of GatewayOpenApiOptions.

property CacheTtlSeconds #

public int CacheTtlSeconds { get; set; }

How long the aggregated document is cached, in seconds. The default is 300.

property Description #

public string Description { get; set; }

The description of the document.

property Enabled #

public bool Enabled { get; set; }

Whether the gateway serves the aggregated OpenAPI document. The default is true.

property ServerUrl #

public string ServerUrl { get; set; }

The server URL the document declares. The default is /.

property Title #

public string Title { get; set; }

The title of the document. The default is Gateway API.

property TokenUrl #

public string? TokenUrl { get; set; }

The OAuth2 token URL of the client-credentials flow the endpoint scopes are obtained from. Unset by default: the document declares the bearer scheme only.

property Version #

public string Version { get; set; }

The version of the document. The default is 1.0.0.

class GatewayOptions

public sealed class GatewayOptions

The Gateway section that the router gateway pipeline reads: node identity, transports, routing, OpenAPI and health. The settings only the Stella Ops gateway reads (Auth, HttpClient, HttpsRedirect, Routes) bind into that host’s own options from the same section.

Members

MemberKindSummary
GatewayOptions()constructorCreates an instance of GatewayOptions.
SectionNameconstantThe configuration section the options bind from: Gateway.
HealthpropertyWhen a connected instance counts as degraded or stale, and which services readiness requires.
NodepropertyThe identity and region of this gateway node.
OpenApipropertyThe OpenAPI document the gateway builds from the connected microservices.
RoutingpropertyHow the gateway routes a request: timeouts, the request body limit and instance selection.
TransportspropertyThe listeners that microservices connect to, one section per transport.

constructor GatewayOptions() #

public GatewayOptions()

Creates an instance of GatewayOptions.

constant SectionName #

public const string SectionName = "Gateway"

The configuration section the options bind from: Gateway.

property Health #

public GatewayHealthOptions Health { get; set; }

When a connected instance counts as degraded or stale, and which services readiness requires.

property Node #

public GatewayNodeOptions Node { get; set; }

The identity and region of this gateway node.

property OpenApi #

public GatewayOpenApiOptions OpenApi { get; set; }

The OpenAPI document the gateway builds from the connected microservices.

property Routing #

public GatewayRoutingOptions Routing { get; set; }

How the gateway routes a request: timeouts, the request body limit and instance selection.

property Transports #

public GatewayTransportOptions Transports { get; set; }

The listeners that microservices connect to, one section per transport.

class GatewayOptionsValidator

public static class GatewayOptionsValidator

Validates the GatewayOptionsof the router gateway pipeline at startup. The Stella Ops gateway validates its own settings (route table, HTTPS redirect) separately.

Members

MemberKindSummary
Validate(GatewayOptions)methodValidates the options: a node region, a positive port for each enabled listener, a TLS certificate path, a RabbitMQ host and node id when RabbitMQ is enabled, and parseable durations and sizes.

method Validate(GatewayOptions) #

public static void Validate(GatewayOptions options)

Validates the options: a node region, a positive port for each enabled listener, a TLS certificate path, a RabbitMQ host and node id when RabbitMQ is enabled, and parseable durations and sizes.

Parameters

  • options: The options to validate.

Exceptions

  • InvalidOperationException: A setting is missing or invalid.

class GatewayRabbitMqTransportOptions

public sealed class GatewayRabbitMqTransportOptions

RabbitMQ consumer for microservices. The RabbitMQ transport plugin binds this section into RabbitMqTransportOptions (credentials included). Microservices publish to the gateway’s GatewayRabbitMqTransportOptions.NodeId, so it is required.

Members

MemberKindSummary
GatewayRabbitMqTransportOptions()constructorCreates an instance of GatewayRabbitMqTransportOptions.
EnabledpropertyWhether the gateway consumes microservice traffic from RabbitMQ.
HostNamepropertyThe RabbitMQ broker host name.
NodeIdpropertyThe gateway node identifier that microservices publish to.
PortpropertyThe RabbitMQ broker port.

constructor GatewayRabbitMqTransportOptions() #

public GatewayRabbitMqTransportOptions()

Creates an instance of GatewayRabbitMqTransportOptions.

property Enabled #

public bool Enabled { get; set; }

Whether the gateway consumes microservice traffic from RabbitMQ. The default is false.

property HostName #

public string HostName { get; set; }

The RabbitMQ broker host name. Required when the transport is enabled; the default is localhost.

property NodeId #

public string? NodeId { get; set; }

The gateway node identifier that microservices publish to. Required when the transport is enabled.

property Port #

public int Port { get; set; }

The RabbitMQ broker port. The default is 5672.

class GatewayRoutingOptions

public sealed class GatewayRoutingOptions

How the gateway routes a request (Gateway:Routing). A duration is a TimeSpan string or a number with the unit ms, s, m or h (for example 30s); a number without a unit is seconds. A size is a number with the unit b, kb, mb or gb (for example 100MB).

Members

MemberKindSummary
GatewayRoutingOptions()constructorCreates an instance of GatewayRoutingOptions.
AllowDegradedInstancespropertyWhether a request may go to a degraded instance when no healthy instance is available.
DefaultTimeoutpropertyThe default timeout of a routed request.
GlobalTimeoutCappropertyGlobal timeout cap applied after endpoint and route timeout resolution.
MaxRequestBodySizepropertyThe largest request body the gateway accepts for one call.
PreferLocalRegionpropertyWhether instances in the gateway’s own region are preferred over neighbor regions.
PublishedEndpointRoutingpropertyReserved for routing by HELLO-published endpoints ahead of the SPA catch-all.

constructor GatewayRoutingOptions() #

public GatewayRoutingOptions()

Creates an instance of GatewayRoutingOptions.

property AllowDegradedInstances #

public bool AllowDegradedInstances { get; set; }

Whether a request may go to a degraded instance when no healthy instance is available. The default is true.

property DefaultTimeout #

public string DefaultTimeout { get; set; }

The default timeout of a routed request. The default is 30s.

property GlobalTimeoutCap #

public string GlobalTimeoutCap { get; set; }

Global timeout cap applied after endpoint and route timeout resolution.

property MaxRequestBodySize #

public string MaxRequestBodySize { get; set; }

The largest request body the gateway accepts for one call. The default is 100MB.

property PreferLocalRegion #

public bool PreferLocalRegion { get; set; }

Whether instances in the gateway’s own region are preferred over neighbor regions. The default is true.

property PublishedEndpointRouting #

public bool PublishedEndpointRouting { get; set; }

Reserved for routing by HELLO-published endpoints ahead of the SPA catch-all. The gateway that these packages build does not read this option, so setting it has no effect. The default is false.

class GatewayTcpTransportOptions

public sealed class GatewayTcpTransportOptions

TCP listener for microservices (Gateway:Transports:Tcp).

Members

MemberKindSummary
GatewayTcpTransportOptions()constructorCreates an instance of GatewayTcpTransportOptions.
BindAddresspropertyThe local address the listener binds to.
EnabledpropertyWhether the gateway listens for microservices over TCP.
MaxFrameSizepropertyThe largest frame the listener accepts, in bytes.
PortpropertyThe port the listener binds to; greater than zero when the transport is enabled.
ReceiveBufferSizepropertyThe socket receive buffer size in bytes.
SendBufferSizepropertyThe socket send buffer size in bytes.

constructor GatewayTcpTransportOptions() #

public GatewayTcpTransportOptions()

Creates an instance of GatewayTcpTransportOptions.

property BindAddress #

public string BindAddress { get; set; }

The local address the listener binds to. The default is all IPv4 addresses (0.0.0.0).

property Enabled #

public bool Enabled { get; set; }

Whether the gateway listens for microservices over TCP. The default is false.

property MaxFrameSize #

public int MaxFrameSize { get; set; }

The largest frame the listener accepts, in bytes. The default is 16 MB.

property Port #

public int Port { get; set; }

The port the listener binds to; greater than zero when the transport is enabled. The default is 9100.

property ReceiveBufferSize #

public int ReceiveBufferSize { get; set; }

The socket receive buffer size in bytes. The default is 64 KB.

property SendBufferSize #

public int SendBufferSize { get; set; }

The socket send buffer size in bytes. The default is 64 KB.

class GatewayTlsTransportOptions

public sealed class GatewayTlsTransportOptions

TLS listener for microservices (Gateway:Transports:Tls). The TLS transport plugin binds this whole section into its own transport options, so the certificate settings carry that type’s names.

Members

MemberKindSummary
GatewayTlsTransportOptions()constructorCreates an instance of GatewayTlsTransportOptions.
AllowSelfSignedpropertyWhether self-signed certificates are accepted.
BindAddresspropertyThe local address the listener binds to.
EnabledpropertyWhether the gateway listens for microservices over TLS.
MaxFrameSizepropertyThe largest frame the listener accepts, in bytes.
PortpropertyThe port the listener binds to; greater than zero when the transport is enabled.
ReceiveBufferSizepropertyThe socket receive buffer size in bytes.
RequireClientCertificatepropertyWhether a microservice must present a client certificate (mutual TLS).
SendBufferSizepropertyThe socket send buffer size in bytes.
ServerCertificateKeyPathpropertyThe private key file of a PEM server certificate.
ServerCertificatePasswordpropertyThe password of a PFX server certificate.
ServerCertificatePathpropertyThe server certificate file, PEM or PFX.

constructor GatewayTlsTransportOptions() #

public GatewayTlsTransportOptions()

Creates an instance of GatewayTlsTransportOptions.

property AllowSelfSigned #

public bool AllowSelfSigned { get; set; }

Whether self-signed certificates are accepted. The default is false; set it for development only.

property BindAddress #

public string BindAddress { get; set; }

The local address the listener binds to. The default is all IPv4 addresses (0.0.0.0).

property Enabled #

public bool Enabled { get; set; }

Whether the gateway listens for microservices over TLS. The default is false.

property MaxFrameSize #

public int MaxFrameSize { get; set; }

The largest frame the listener accepts, in bytes. The default is 16 MB.

property Port #

public int Port { get; set; }

The port the listener binds to; greater than zero when the transport is enabled. The default is 9443.

property ReceiveBufferSize #

public int ReceiveBufferSize { get; set; }

The socket receive buffer size in bytes. The default is 64 KB.

property RequireClientCertificate #

public bool RequireClientCertificate { get; set; }

Whether a microservice must present a client certificate (mutual TLS). The default is false.

property SendBufferSize #

public int SendBufferSize { get; set; }

The socket send buffer size in bytes. The default is 64 KB.

property ServerCertificateKeyPath #

public string? ServerCertificateKeyPath { get; set; }

The private key file of a PEM server certificate.

property ServerCertificatePassword #

public string? ServerCertificatePassword { get; set; }

The password of a PFX server certificate.

property ServerCertificatePath #

public string? ServerCertificatePath { get; set; }

The server certificate file, PEM or PFX. Required when the transport is enabled.

class GatewayTransportOptions

public sealed class GatewayTransportOptions

The transport listeners of the gateway (Gateway:Transports). A transport starts only when its Enabled setting is true; the host fails at startup when an enabled transport has no server-side transport plugin loaded.

Members

MemberKindSummary
GatewayTransportOptions()constructorCreates an instance of GatewayTransportOptions.
MessagingpropertyThe queue-backed Messaging transport, for example over Valkey.
RabbitMqpropertyThe RabbitMQ consumer.
TcppropertyThe TCP listener.
TlspropertyThe TLS listener.
UdppropertyThe UDP listener.

constructor GatewayTransportOptions() #

public GatewayTransportOptions()

Creates an instance of GatewayTransportOptions.

property Messaging #

public GatewayMessagingTransportOptions Messaging { get; set; }

The queue-backed Messaging transport, for example over Valkey.

property RabbitMq #

public GatewayRabbitMqTransportOptions RabbitMq { get; set; }

The RabbitMQ consumer.

property Tcp #

public GatewayTcpTransportOptions Tcp { get; set; }

The TCP listener.

property Tls #

public GatewayTlsTransportOptions Tls { get; set; }

The TLS listener.

property Udp #

public GatewayUdpTransportOptions Udp { get; set; }

The UDP listener.

class GatewayUdpTransportOptions

public sealed class GatewayUdpTransportOptions

UDP listener for microservices. The UDP transport plugin binds this section into UdpTransportOptions; a HELLO and every response must fit one datagram.

Members

MemberKindSummary
GatewayUdpTransportOptions()constructorCreates an instance of GatewayUdpTransportOptions.
BindAddresspropertyThe local address the listener binds to.
EnabledpropertyWhether the gateway listens for microservices over UDP.
MaxDatagramSizepropertyThe largest datagram in bytes; greater than zero when the transport is enabled.
PortpropertyThe port the listener binds to; greater than zero when the transport is enabled.

constructor GatewayUdpTransportOptions() #

public GatewayUdpTransportOptions()

Creates an instance of GatewayUdpTransportOptions.

property BindAddress #

public string BindAddress { get; set; }

The local address the listener binds to. The default is all IPv4 addresses (0.0.0.0).

property Enabled #

public bool Enabled { get; set; }

Whether the gateway listens for microservices over UDP. The default is false.

property MaxDatagramSize #

public int MaxDatagramSize { get; set; }

The largest datagram in bytes; greater than zero when the transport is enabled. The default is 8192.

property Port #

public int Port { get; set; }

The port the listener binds to; greater than zero when the transport is enabled. The default is 5102.

class GatewayValueParser

public static class GatewayValueParser

Parses the duration and size strings of the gateway configuration, for example 30s and 100MB.

Members

MemberKindSummary
ParseDuration(string, TimeSpan)methodParses a duration: a TimeSpan string, or a number with the unit ms, s, m or h; a number without a unit is seconds.
ParseSizeBytes(string, long)methodParses a size: a number with the unit b, kb, mb or gb (1024-based); a number without a unit is bytes.

method ParseDuration(string, TimeSpan) #

public static TimeSpan ParseDuration(string? value, TimeSpan fallback)

Parses a duration: a TimeSpan string, or a number with the unit ms, s, m or h; a number without a unit is seconds.

Parameters

  • value: The text to parse.
  • fallback: The result when the text is empty.

Returns

The duration.

Exceptions

  • InvalidOperationException: The text is not a duration.

method ParseSizeBytes(string, long) #

public static long ParseSizeBytes(string? value, long fallback)

Parses a size: a number with the unit b, kb, mb or gb (1024-based); a number without a unit is bytes.

Parameters

  • value: The text to parse.
  • fallback: The result when the text is empty.

Returns

The size in bytes.

Exceptions

  • InvalidOperationException: The text is not a size.

namespace StellaOps.Router.Gateway.Hosting.Endpoints

TypeKindDescription
RouterAdministrationEndpointsclassMaps the router administration endpoints of the gateway.
RouterEndpointInventoryEndpointsclassThe read-only list of the distinct Endpoints registered with this gateway, as the licence monitor counts them (RouterEndpointCount): one entry per method group and path template, with the method tokens, templates and services that register it.
RouterInstancesEndpointsclassExposes the gateway-local instance registry so operators and deployment tooling can discover the live service instances and their effective routing weights without scraping gateway logs.
RoutingWeightEndpointsclassMaps the routing weight endpoints: read and change the weight overrides of service instances.

class RouterAdministrationEndpoints

public static class RouterAdministrationEndpoints

Maps the router administration endpoints of the gateway.

Members

MemberKindSummary
ResyncPathconstantThe path of the endpoint that asks connected microservices to replay their endpoint metadata.
RoutePrefixconstantThe route prefix of the administration endpoints.
MapRouterAdministrationEndpoints(IEndpointRouteBuilder)extension methodMaps POST RouterAdministrationEndpoints.ResyncPath, which asks one connection, or every connection when the request names none, to replay its endpoint metadata.

constant ResyncPath #

public const string ResyncPath = "/api/v1/gateway/administration/router/resync"

The path of the endpoint that asks connected microservices to replay their endpoint metadata.

constant RoutePrefix #

public const string RoutePrefix = "/api/v1/gateway/administration"

The route prefix of the administration endpoints.

extension method MapRouterAdministrationEndpoints(IEndpointRouteBuilder) #

public static IEndpointRouteBuilder MapRouterAdministrationEndpoints(this IEndpointRouteBuilder endpoints)

Maps POST RouterAdministrationEndpoints.ResyncPath, which asks one connection, or every connection when the request names none, to replay its endpoint metadata. The endpoint requires the RoutingWeightEndpoints.RouterRoutingWritePolicypolicy and answers 404 when no connection matches.

Parameters

  • endpoints: The endpoint route builder to map the endpoint on.

Returns

The same endpoint route builder, for chaining.

class RouterEndpointInventoryEndpoints

public static class RouterEndpointInventoryEndpoints

The read-only list of the distinct Endpoints registered with this gateway, as the licence monitor counts them (RouterEndpointCount): one entry per method group and path template, with the method tokens, templates and services that register it. An operator with several gateways unions their lists to count the Installation’s Endpoints once. Behind the router:routing:read scope, like the instance list. The standalone gateway host maps it.

Members

MemberKindSummary
EndpointsPathconstantThe path of the list.
MapRouterEndpointInventory(IEndpointRouteBuilder)extension methodMaps GET RouterEndpointInventoryEndpoints.EndpointsPath.

constant EndpointsPath #

public const string EndpointsPath = "/api/v1/router/endpoints"

The path of the list.

extension method MapRouterEndpointInventory(IEndpointRouteBuilder) #

public static IEndpointRouteBuilder MapRouterEndpointInventory(this IEndpointRouteBuilder endpoints)

Maps GET RouterEndpointInventoryEndpoints.EndpointsPath.

class RouterInstancesEndpoints

public static class RouterInstancesEndpoints

Exposes the gateway-local instance registry so operators and deployment tooling can discover the live service instances and their effective routing weights without scraping gateway logs.

This is the read-side discovery counterpart to RoutingWeightEndpoints; it reuses the same RoutingWeightEndpoints.RouterRoutingReadPolicy(admin-scoped router:routing:read) authorization gate.

Members

MemberKindSummary
InstancesPathconstantThe path of the instance list endpoint.
MapRouterInstancesEndpoints(IEndpointRouteBuilder)extension methodMaps GET RouterInstancesEndpoints.InstancesPath, which lists the connected service instances with their version, region, weight and health; the optional service query parameter filters by service.

constant InstancesPath #

public const string InstancesPath = "/api/v1/router/instances"

The path of the instance list endpoint.

extension method MapRouterInstancesEndpoints(IEndpointRouteBuilder) #

public static IEndpointRouteBuilder MapRouterInstancesEndpoints(this IEndpointRouteBuilder endpoints)

Maps GET RouterInstancesEndpoints.InstancesPath, which lists the connected service instances with their version, region, weight and health; the optional service query parameter filters by service. The endpoint requires the RoutingWeightEndpoints.RouterRoutingReadPolicypolicy.

Parameters

  • endpoints: The endpoint route builder to map the endpoint on.

Returns

The same endpoint route builder, for chaining.

class RoutingWeightEndpoints

public static class RoutingWeightEndpoints

Maps the routing weight endpoints: read and change the weight overrides of service instances. The overrides are process-local: each gateway node keeps its own.

Members

MemberKindSummary
RouterRoutingReadPolicyconstantThe authorization policy for reading the routing weights and the instance list.
RouterRoutingReadScopeconstantThe scope the read policy requires in the scope or scp claim of the router gateway host.
RouterRoutingWritePolicyconstantThe authorization policy for changing routing weights and for requesting an endpoint metadata replay.
RouterRoutingWriteScopeconstantThe scope the write policy requires in the scope or scp claim of the router gateway host.
WeightsPathconstantThe path of the routing weight endpoints.
MapRoutingWeightEndpoints(IEndpointRouteBuilder)extension methodMaps GET RoutingWeightEndpoints.WeightsPath, which returns the weight overrides and the effective weight of each live instance (RoutingWeightEndpoints.RouterRoutingReadPolicy), and POST, which adds or updates one override for a service version or one of its instances (RoutingWeightEndpoints.RouterRoutingWritePolicy).

constant RouterRoutingReadPolicy #

public const string RouterRoutingReadPolicy = "router.routing.read"

The authorization policy for reading the routing weights and the instance list.

constant RouterRoutingReadScope #

public const string RouterRoutingReadScope = "router:routing:read"

The scope the read policy requires in the scope or scp claim of the router gateway host.

constant RouterRoutingWritePolicy #

public const string RouterRoutingWritePolicy = "router.routing.write"

The authorization policy for changing routing weights and for requesting an endpoint metadata replay.

constant RouterRoutingWriteScope #

public const string RouterRoutingWriteScope = "router:routing:write"

The scope the write policy requires in the scope or scp claim of the router gateway host.

constant WeightsPath #

public const string WeightsPath = "/api/v1/router/routing/weights"

The path of the routing weight endpoints.

extension method MapRoutingWeightEndpoints(IEndpointRouteBuilder) #

public static IEndpointRouteBuilder MapRoutingWeightEndpoints(this IEndpointRouteBuilder endpoints)

Maps GET RoutingWeightEndpoints.WeightsPath, which returns the weight overrides and the effective weight of each live instance (RoutingWeightEndpoints.RouterRoutingReadPolicy), and POST, which adds or updates one override for a service version or one of its instances (RoutingWeightEndpoints.RouterRoutingWritePolicy).

Parameters

  • endpoints: The endpoint route builder to map the endpoints on.

Returns

The same endpoint route builder, for chaining.

namespace StellaOps.Router.Gateway.Hosting.Licensing

TypeKindDescription
IRouterLicenceReleaseContextinterfaceThe inputs of a licence evaluation that come from the release and the operator, not from the installation’s use: the running version’s first-publication date and the vendor trust roots.
RouterComponentLicenceOptionsclassConfiguration of the component licence reader, section StellaOps:ComponentLicence.
RouterCountedEndpointrecordOne counted Endpoint: a method group and a path template under the comparison rules, with the registrations that make it up.
RouterEndpointCountclassCounts the Endpoints registered with this gateway under the Endpoint definition of the Router licence (clause 1), as far as the gateway can observe them: each distinct combination of a method group and a path template, once, whatever the services, instances or versions that register it.
RouterEndpointMethodGroupenumThe method group of a counted Endpoint (Router licence, clause 1).
RouterLicenceAssessorclassEvaluates the gateway’s licence status: counts the distinct Endpoints registered with the gateway (RouterEndpointCount), reads the licence records offline (the file or directory of StellaOps:ComponentLicence:Path, or the licence key of StellaOps:ComponentLicence:Key) and runs the shared component licence evaluator against the running version’s first-publication date.
RouterLicenceMetricsclassThe licence gauge on the meter RouterLicenceMetrics.MeterName: the Endpoint count of the latest evaluation, tagged with its status name.
RouterLicenceMonitorclassEvaluates the gateway’s licence status once the host has started and then every RouterLicenceMonitor.EvaluationInterval, so the health detail and the gauge follow the Endpoints the microservices register as they connect, and the warning log appears at startup and hourly while the status warrants it (RouterLicenceAssessor).
RouterLicenceReleaseContextclassThe release context of the running gateway: the stamp of the StellaOps.Router.Gateway.Hosting assembly and the roots of ComponentLicenceTrustRoots.FromEnvironment(IEs256Verifier) (the embedded published root, or the set STELLAOPS_VENDOR_TRUST_ROOTS names).
RouterLicenceSnapshotrecordOne licence evaluation of the running gateway, as the health detail and the gauges report it.
RouterLicenceStateclassThe latest licence evaluation of this gateway, read by the health detail and the gauges.

interface IRouterLicenceReleaseContext

public interface IRouterLicenceReleaseContext

The inputs of a licence evaluation that come from the release and the operator, not from the installation’s use: the running version’s first-publication date and the vendor trust roots.

Members

MemberKindSummary
PublishedAtpropertyThe StellaOps.Component.PublishedAt stamp of the gateway’s source release; a build or adaptation of a released version keeps it, and its own build date is never used.
ResolveTrustRoots()methodThe vendor-entitlement roots that licence file signatures are checked against, resolved per evaluation.

property PublishedAt #

DateOnly? PublishedAt { get; }

The StellaOps.Component.PublishedAt stamp of the gateway’s source release; a build or adaptation of a released version keeps it, and its own build date is never used. null in a development build.

method ResolveTrustRoots() #

ComponentLicenceTrustRoots ResolveTrustRoots()

The vendor-entitlement roots that licence file signatures are checked against, resolved per evaluation.

class RouterComponentLicenceOptions

public sealed class RouterComponentLicenceOptions

Configuration of the component licence reader, section StellaOps:ComponentLicence. Every value is optional: without a licence record the gateway reports the status of its count, and an invalid value never stops the host (the record is then not loaded, with the reason as a detail). Configure the record as a RouterComponentLicenceOptions.Pathor as a RouterComponentLicenceOptions.Key, not both: with both set, neither is read and the licence details report conflicting_sources.

Members

MemberKindSummary
RouterComponentLicenceOptions()constructorCreates an instance of RouterComponentLicenceOptions.
SectionNameconstantThe configuration section.
InstallationIdpropertyThe Installation identifier the licence records name: a lowercase UUID.
KeypropertyThe licence key: the standard base64 encoding of one licence file, as one line.
PathpropertyA licence file, or a directory whose *.dsse.json files are read.

constructor RouterComponentLicenceOptions() #

public RouterComponentLicenceOptions()

Creates an instance of RouterComponentLicenceOptions.

constant SectionName #

public const string SectionName = "StellaOps:ComponentLicence"

The configuration section.

property InstallationId #

public string? InstallationId { get; set; }

The Installation identifier the licence records name: a lowercase UUID.

property Key #

public string? Key { get; set; }

The licence key: the standard base64 encoding of one licence file, as one line. It is read and verified exactly as the file; base64 is an encoding, not a protection.

property Path #

public string? Path { get; set; }

A licence file, or a directory whose *.dsse.json files are read. Local path only.

record RouterCountedEndpoint

public sealed record RouterCountedEndpoint

One counted Endpoint: a method group and a path template under the comparison rules, with the registrations that make it up.

Parameters

  • Group: The method group.
  • Method: The individually counted method; null for the extension and any-method groups.
  • Template: The template in its comparison form: literal text as registered, each parameter reduced to its structure.
  • RegisteredMethods: The method tokens registered for it, in ordinal order.
  • RegisteredTemplates: The templates registered for it, in ordinal order.
  • Services: The services that register it, in ordinal order.
  • Instances: The connected instances that register it.

Members

MemberKindSummary
RouterCountedEndpoint(RouterEndpointMethodGroup, string, string, IReadOnlyList<string>, IReadOnlyList<string>, IReadOnlyList<string>, int)constructorOne counted Endpoint: a method group and a path template under the comparison rules, with the registrations that make it up.
GrouppropertyThe method group.
InstancespropertyThe connected instances that register it.
MethodpropertyThe individually counted method; null for the extension and any-method groups.
RegisteredMethodspropertyThe method tokens registered for it, in ordinal order.
RegisteredTemplatespropertyThe templates registered for it, in ordinal order.
ServicespropertyThe services that register it, in ordinal order.
TemplatepropertyThe template in its comparison form: literal text as registered, each parameter reduced to its structure.

constructor RouterCountedEndpoint(RouterEndpointMethodGroup, string, string, IReadOnlyList<string>, IReadOnlyList<string>, IReadOnlyList<string>, int) #

public RouterCountedEndpoint(RouterEndpointMethodGroup Group, string? Method, string Template, IReadOnlyList<string> RegisteredMethods, IReadOnlyList<string> RegisteredTemplates, IReadOnlyList<string> Services, int Instances)

One counted Endpoint: a method group and a path template under the comparison rules, with the registrations that make it up.

Parameters

  • Group: The method group.
  • Method: The individually counted method; null for the extension and any-method groups.
  • Template: The template in its comparison form: literal text as registered, each parameter reduced to its structure.
  • RegisteredMethods: The method tokens registered for it, in ordinal order.
  • RegisteredTemplates: The templates registered for it, in ordinal order.
  • Services: The services that register it, in ordinal order.
  • Instances: The connected instances that register it.

property Group #

public RouterEndpointMethodGroup Group { get; init; }

The method group.

property Instances #

public int Instances { get; init; }

The connected instances that register it.

property Method #

public string? Method { get; init; }

The individually counted method; null for the extension and any-method groups.

property RegisteredMethods #

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

The method tokens registered for it, in ordinal order.

property RegisteredTemplates #

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

The templates registered for it, in ordinal order.

property Services #

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

The services that register it, in ordinal order.

property Template #

public string Template { get; init; }

The template in its comparison form: literal text as registered, each parameter reduced to its structure.

class RouterEndpointCount

public static class RouterEndpointCount

Counts the Endpoints registered with this gateway under the Endpoint definition of the Router licence (clause 1), as far as the gateway can observe them: each distinct combination of a method group and a path template, once, whatever the services, instances or versions that register it.

Remarks

Method groups: GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS and TRACE count individually (a frozen list); every other token, PATCH included, counts in one extension-method Endpoint per template; every entry that accepts any method (EndpointDescriptor.AnyMethod) counts in one any-method Endpoint per template. The three groups count separately. Method tokens compare case-sensitively, so get is an extension-method token. HEAD and OPTIONS count only where registered; they are not inferred from GET.

Templates: literal text, its letter case and its slashes compare as registered; within a parameter the name, the constraints and a default value itself are disregarded, and the catch-all form (* or **), the optional marker and the presence of a default value are kept. Templates are compared as written and never expanded.

Only what services register is counted: the gateway’s own health, metrics and API-description paths are answered by the gateway and never enter the routing state, so they are excluded by their provenance, and a service’s own route named /health counts. The count is the current set of registrations, not a running total. It is the displayed count, which is not conclusive: the licence counts the Endpoints configured for production routing, including routes the gateway does not see.

Members

MemberKindSummary
IndividuallyCountedMethodsfieldThe individually counted methods (Router licence, clause 1).
ComparisonTemplate(string)methodThe comparison form of a path template: literal text unchanged; each parameter reduced to {, its catch-all stars, = when it has a default value, ? when it is optional, and }.
Count(IEnumerable<ConnectionState>)methodThe number of distinct Endpoints registered by connections.
Inventory(IEnumerable<ConnectionState>)methodThe distinct Endpoints registered by connections, ordered by template, then method group (individual, extension, any), then method.
MethodGroup(string)methodThe method group of a registered method token, and the method for the individual group.

field IndividuallyCountedMethods #

public static readonly FrozenSet<string> IndividuallyCountedMethods

The individually counted methods (Router licence, clause 1). The list is frozen.

method ComparisonTemplate(string) #

public static string ComparisonTemplate(string template)

The comparison form of a path template: literal text unchanged; each parameter reduced to {, its catch-all stars, = when it has a default value, ? when it is optional, and }. So /files/{**path:nonfile} is /files/{**}, /items/{id:int?} is /items/{?} and /items/{itemId} is /items/{}. Doubled braces are literal braces.

method Count(IEnumerable<ConnectionState>) #

public static int Count(IEnumerable<ConnectionState> connections)

The number of distinct Endpoints registered by connections.

method Inventory(IEnumerable<ConnectionState>) #

public static IReadOnlyList<RouterCountedEndpoint> Inventory(IEnumerable<ConnectionState> connections)

The distinct Endpoints registered by connections, ordered by template, then method group (individual, extension, any), then method.

method MethodGroup(string) #

public static (RouterEndpointMethodGroup Group, string? Method) MethodGroup(string method)

The method group of a registered method token, and the method for the individual group.

enum RouterEndpointMethodGroup

public enum RouterEndpointMethodGroup

The method group of a counted Endpoint (Router licence, clause 1).

ValueDescription
Individual = 0One of the individually counted methods: GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE.
Extension = 1Every other explicitly enabled method token of one template, PATCH included, counted together.
Any = 2Every entry of one template that accepts any method, counted together.

class RouterLicenceAssessor

public sealed class RouterLicenceAssessor

Evaluates the gateway’s licence status: counts the distinct Endpoints registered with the gateway (RouterEndpointCount), reads the licence records offline (the file or directory of StellaOps:ComponentLicence:Path, or the licence key of StellaOps:ComponentLicence:Key) and runs the shared component licence evaluator against the running version’s first-publication date. Informational only: it refuses, slows or stops nothing, makes no network call and sends nothing anywhere; a failure to read the records is reported as a detail, never thrown. Each evaluation also carries the licence notice (“Licensed to” the licensee of a covering record, or the message of its case), logged at startup and once per hour.

Members

MemberKindSummary
RouterLicenceAssessor(IGlobalRoutingState, IOptionsMonitor<RouterComponentLicenceOptions>, IRouterLicenceReleaseContext, RouterLicenceState, TimeProvider, ILogger<RouterLicenceAssessor>)constructorEvaluates the gateway’s licence status: counts the distinct Endpoints registered with the gateway (RouterEndpointCount), reads the licence records offline (the file or directory of StellaOps:ComponentLicence:Path, or the licence key of StellaOps:ComponentLicence:Key) and runs the shared component licence evaluator against the running version’s first-publication date.
NoticeIntervalfieldThe interval between two notice lines while the notice stays the same.
WarningIntervalfieldThe interval between two warnings while a warning status persists.
EvaluateAsync(CancellationToken)methodRuns one evaluation and publishes it to RouterLicenceState.

constructor RouterLicenceAssessor(IGlobalRoutingState, IOptionsMonitor<RouterComponentLicenceOptions>, IRouterLicenceReleaseContext, RouterLicenceState, TimeProvider, ILogger<RouterLicenceAssessor>) #

public RouterLicenceAssessor(IGlobalRoutingState routingState, IOptionsMonitor<RouterComponentLicenceOptions> options, IRouterLicenceReleaseContext releaseContext, RouterLicenceState state, TimeProvider timeProvider, ILogger<RouterLicenceAssessor> logger)

Evaluates the gateway’s licence status: counts the distinct Endpoints registered with the gateway (RouterEndpointCount), reads the licence records offline (the file or directory of StellaOps:ComponentLicence:Path, or the licence key of StellaOps:ComponentLicence:Key) and runs the shared component licence evaluator against the running version’s first-publication date. Informational only: it refuses, slows or stops nothing, makes no network call and sends nothing anywhere; a failure to read the records is reported as a detail, never thrown. Each evaluation also carries the licence notice (“Licensed to” the licensee of a covering record, or the message of its case), logged at startup and once per hour.

field NoticeInterval #

public static readonly TimeSpan NoticeInterval

The interval between two notice lines while the notice stays the same.

field WarningInterval #

public static readonly TimeSpan WarningInterval

The interval between two warnings while a warning status persists.

method EvaluateAsync(CancellationToken) #

public Task<RouterLicenceSnapshot> EvaluateAsync(CancellationToken cancellationToken = default)

Runs one evaluation and publishes it to RouterLicenceState. While the status warns (ComponentLicenceAssessment.Warns: above the notice level without a covering record, or above the free limit without a record that covers the version and the count), a warning is logged on the first evaluation, when the status changes and then once per RouterLicenceAssessor.WarningInterval; any other status is logged at information level on the first evaluation and when it changes. The licence notice is logged at information level before every status line, when it changes, and otherwise once per RouterLicenceAssessor.NoticeInterval, in every status.

class RouterLicenceMetrics

public sealed class RouterLicenceMetrics : IDisposable

The licence gauge on the meter RouterLicenceMetrics.MeterName: the Endpoint count of the latest evaluation, tagged with its status name. It reaches only the metrics pipeline the operator configures, and the gateway’s /metrics text; nothing is sent to the vendor.

Members

MemberKindSummary
RouterLicenceMetrics(RouterLicenceState, IMeterFactory)constructorCreates the gauge.
EndpointsGaugeconstantThe gauge of the Endpoint count.
MeterNameconstantThe meter name.
StatusTagconstantThe status tag of the gauge.
MeterpropertyThe meter of this instance.
Dispose()methodSee IDisposable.Dispose().

constructor RouterLicenceMetrics(RouterLicenceState, IMeterFactory) #

public RouterLicenceMetrics(RouterLicenceState state, IMeterFactory? meterFactory = null)

Creates the gauge.

Parameters

  • state: The latest evaluation.
  • meterFactory: The host’s meter factory; a private meter when absent.

constant EndpointsGauge #

public const string EndpointsGauge = "stellaops.router.licence.endpoints"

The gauge of the Endpoint count.

constant MeterName #

public const string MeterName = "StellaOps.Router.Licence"

The meter name.

constant StatusTag #

public const string StatusTag = "licence.status"

The status tag of the gauge.

property Meter #

public Meter Meter { get; }

The meter of this instance.

method Dispose() #

public void Dispose()

See IDisposable.Dispose().

class RouterLicenceMonitor

public sealed class RouterLicenceMonitor : BackgroundService

Evaluates the gateway’s licence status once the host has started and then every RouterLicenceMonitor.EvaluationInterval, so the health detail and the gauge follow the Endpoints the microservices register as they connect, and the warning log appears at startup and hourly while the status warrants it (RouterLicenceAssessor). It never stops, delays or degrades the gateway: a failed evaluation is logged and retried at the next interval.

Members

MemberKindSummary
RouterLicenceMonitor(RouterLicenceAssessor, RouterLicenceMetrics, TimeProvider, ILogger<RouterLicenceMonitor>, IHostApplicationLifetime)constructorEvaluates the gateway’s licence status once the host has started and then every RouterLicenceMonitor.EvaluationInterval, so the health detail and the gauge follow the Endpoints the microservices register as they connect, and the warning log appears at startup and hourly while the status warrants it (RouterLicenceAssessor).
EvaluationIntervalfieldThe interval between evaluations.

constructor RouterLicenceMonitor(RouterLicenceAssessor, RouterLicenceMetrics, TimeProvider, ILogger<RouterLicenceMonitor>, IHostApplicationLifetime) #

public RouterLicenceMonitor(RouterLicenceAssessor assessor, RouterLicenceMetrics metrics, TimeProvider timeProvider, ILogger<RouterLicenceMonitor> logger, IHostApplicationLifetime? lifetime = null)

Evaluates the gateway’s licence status once the host has started and then every RouterLicenceMonitor.EvaluationInterval, so the health detail and the gauge follow the Endpoints the microservices register as they connect, and the warning log appears at startup and hourly while the status warrants it (RouterLicenceAssessor). It never stops, delays or degrades the gateway: a failed evaluation is logged and retried at the next interval.

field EvaluationInterval #

public static readonly TimeSpan EvaluationInterval

The interval between evaluations.

class RouterLicenceReleaseContext

public sealed class RouterLicenceReleaseContext : IRouterLicenceReleaseContext

The release context of the running gateway: the stamp of the StellaOps.Router.Gateway.Hosting assembly and the roots of ComponentLicenceTrustRoots.FromEnvironment(IEs256Verifier) (the embedded published root, or the set STELLAOPS_VENDOR_TRUST_ROOTS names). Local reads only.

Members

MemberKindSummary
RouterLicenceReleaseContext()constructorReads the stamp of the gateway hosting assembly.
PublishedAtpropertyThe StellaOps.Component.PublishedAt stamp of the gateway’s source release; a build or adaptation of a released version keeps it, and its own build date is never used.
ResolveTrustRoots()methodThe vendor-entitlement roots that licence file signatures are checked against, resolved per evaluation.

constructor RouterLicenceReleaseContext() #

public RouterLicenceReleaseContext()

Reads the stamp of the gateway hosting assembly.

property PublishedAt #

public DateOnly? PublishedAt { get; }

The StellaOps.Component.PublishedAt stamp of the gateway’s source release; a build or adaptation of a released version keeps it, and its own build date is never used. null in a development build.

method ResolveTrustRoots() #

public ComponentLicenceTrustRoots ResolveTrustRoots()

The vendor-entitlement roots that licence file signatures are checked against, resolved per evaluation.

record RouterLicenceSnapshot

public sealed record RouterLicenceSnapshot

One licence evaluation of the running gateway, as the health detail and the gauges report it.

Members

MemberKindSummary
RouterLicenceSnapshot()constructorCreates an instance of RouterLicenceSnapshot.
AssessmentpropertyThe component licence evaluator’s result: status, message, counts and details.
InstallationIdConfiguredpropertyWhether an Installation identifier is configured.
LicenceFilesLoadedpropertyLicence records (files, or the licence key) read and loaded.
LicenceFilesNotLoadedpropertyLicence records read and not loaded (the reasons are in the assessment details).
NoticepropertyThe licence notice of this evaluation, built from RouterLicenceSnapshot.Assessment: “Licensed to” the licensee of the record whose entry covers the running version, or the message of the case.
SequencepropertyThe evaluation number in this process, from 1.
Warnspropertytrue while the status is one the monitor warns about (ComponentLicenceAssessment.Warns): every status but within-free-limit and record-matches.

constructor RouterLicenceSnapshot() #

public RouterLicenceSnapshot()

Creates an instance of RouterLicenceSnapshot.

property Assessment #

public required ComponentLicenceAssessment Assessment { get; init; }

The component licence evaluator’s result: status, message, counts and details.

property InstallationIdConfigured #

public required bool InstallationIdConfigured { get; init; }

Whether an Installation identifier is configured.

property LicenceFilesLoaded #

public required int LicenceFilesLoaded { get; init; }

Licence records (files, or the licence key) read and loaded.

property LicenceFilesNotLoaded #

public required int LicenceFilesNotLoaded { get; init; }

Licence records read and not loaded (the reasons are in the assessment details).

property Notice #

public ComponentLicenceNotice Notice { get; }

The licence notice of this evaluation, built from RouterLicenceSnapshot.Assessment: “Licensed to” the licensee of the record whose entry covers the running version, or the message of the case. The log line and the health detail write it with ComponentLicenceNoticeFormatter.Format(ComponentLicenceNotice).

property Sequence #

public required long Sequence { get; init; }

The evaluation number in this process, from 1.

property Warns #

public bool Warns { get; }

true while the status is one the monitor warns about (ComponentLicenceAssessment.Warns): every status but within-free-limit and record-matches.

class RouterLicenceState

public sealed class RouterLicenceState

The latest licence evaluation of this gateway, read by the health detail and the gauges. It is registered only with the licence monitor, which RouterGatewayHostExtensions.AddRouterGatewayHost(WebApplicationBuilder, params Assembly[])composes; a host without it (the Stella Ops gateway) reports no licence detail.

Members

MemberKindSummary
RouterLicenceState()constructorCreates an instance of RouterLicenceState.
EndpointCountNoteconstantThe note on the displayed Endpoint count (Router licence, clause 2): the licence counts the Endpoints configured for production routing, including routes the gateway does not see.
EndpointsMetricconstantThe gauge of the Endpoint count, in the Prometheus text of /metrics.
CurrentpropertyThe latest evaluation; null before the first one.

constructor RouterLicenceState() #

public RouterLicenceState()

Creates an instance of RouterLicenceState.

constant EndpointCountNote #

public const string EndpointCountNote = "The displayed count is not conclusive."

The note on the displayed Endpoint count (Router licence, clause 2): the licence counts the Endpoints configured for production routing, including routes the gateway does not see.

constant EndpointsMetric #

public const string EndpointsMetric = "stellaops_router_licence_endpoints"

The gauge of the Endpoint count, in the Prometheus text of /metrics.

property Current #

public RouterLicenceSnapshot? Current { get; }

The latest evaluation; null before the first one.

namespace StellaOps.Router.Gateway.Hosting.Middleware

TypeKindDescription
GatewayContextKeysclassThe HttpContext.Items keys under which the gateway pipeline keeps the caller’s identity.
GatewayRoutesclassThe paths the gateway answers itself (system paths), which are never routed to a microservice.
HealthCheckMiddlewareclassAnswers the gateway health and metrics paths.
RequestRoutingMiddlewareclassDispatches a routed request to a microservice instance.

class GatewayContextKeys

public static class GatewayContextKeys

The HttpContext.Items keys under which the gateway pipeline keeps the caller’s identity.

Members

MemberKindSummary
ActorconstantThe acting user.
CnfJsonconstantThe confirmation claim of the caller’s token, as JSON.
DpopThumbprintconstantThe thumbprint of the caller’s DPoP key.
IsAnonymousconstantWhether the caller is anonymous.
MtlsThumbprintconstantThe thumbprint of the caller’s client certificate.
ProjectIdconstantThe project of the caller.
ScopesconstantThe scopes of the caller, as a set of strings; the authorization middleware reads them.
TenantIdconstantThe tenant of the caller.

constant Actor #

public const string Actor = "Gateway.Actor"

The acting user.

constant CnfJson #

public const string CnfJson = "Gateway.CnfJson"

The confirmation claim of the caller’s token, as JSON.

constant DpopThumbprint #

public const string DpopThumbprint = "Gateway.DpopThumbprint"

The thumbprint of the caller’s DPoP key.

constant IsAnonymous #

public const string IsAnonymous = "Gateway.IsAnonymous"

Whether the caller is anonymous.

constant MtlsThumbprint #

public const string MtlsThumbprint = "Gateway.MtlsThumbprint"

The thumbprint of the caller’s client certificate.

constant ProjectId #

public const string ProjectId = "Gateway.ProjectId"

The project of the caller.

constant Scopes #

public const string Scopes = "Gateway.Scopes"

The scopes of the caller, as a set of strings; the authorization middleware reads them.

constant TenantId #

public const string TenantId = "Gateway.TenantId"

The tenant of the caller.

class GatewayRoutes

public static class GatewayRoutes

The paths the gateway answers itself (system paths), which are never routed to a microservice.

Members

MemberKindSummary
BuildInfoAggregatorPathconstantThe path of the aggregated build information document.
OpenApiAggregatePathconstantThe path of the aggregated OpenAPI document.
OperatorVerifyPrefixconstantThe path prefix of the operator verification endpoints.
PluginDiagnosticsPrefixconstantThe path prefix of the transport plugin diagnostics.
ProductSecurityJsonPathconstantThe path of the product security document.
RouterAdministrationPrefixconstantThe route prefix of the router administration endpoints.
RouterAdministrationResyncPathconstantThe path of the endpoint metadata replay request.
RouterInstancesPathconstantThe path of the instance list endpoint.
RouterRoutingWeightsPathconstantThe path of the routing weight endpoints.
SecurityTxtPathconstantThe path of the security contact document.
SupportLifecyclePathconstantThe path of the support lifecycle document.
IsHealthPath(PathString)methodWhether the path is a health path: it starts with /health.
IsMetricsPath(PathString)methodWhether the path is /metrics.
IsOperatorVerifyPath(PathString)methodWhether the path is an operator verification path.
IsSystemPath(PathString)methodWhether the gateway answers the path itself and never routes it to a microservice.

constant BuildInfoAggregatorPath #

public const string BuildInfoAggregatorPath = "/buildinfo.json"

The path of the aggregated build information document.

constant OpenApiAggregatePath #

public const string OpenApiAggregatePath = "/api/openapi/aggregate"

The path of the aggregated OpenAPI document.

constant OperatorVerifyPrefix #

public const string OperatorVerifyPrefix = "/api/v1/operator/verify"

The path prefix of the operator verification endpoints.

constant PluginDiagnosticsPrefix #

public const string PluginDiagnosticsPrefix = "/internal/plugins"

The path prefix of the transport plugin diagnostics.

constant ProductSecurityJsonPath #

public const string ProductSecurityJsonPath = "/.well-known/stella-product-security.json"

The path of the product security document.

constant RouterAdministrationPrefix #

public const string RouterAdministrationPrefix = "/api/v1/gateway/administration"

The route prefix of the router administration endpoints.

constant RouterAdministrationResyncPath #

public const string RouterAdministrationResyncPath = "/api/v1/gateway/administration/router/resync"

The path of the endpoint metadata replay request.

constant RouterInstancesPath #

public const string RouterInstancesPath = "/api/v1/router/instances"

The path of the instance list endpoint.

constant RouterRoutingWeightsPath #

public const string RouterRoutingWeightsPath = "/api/v1/router/routing/weights"

The path of the routing weight endpoints.

constant SecurityTxtPath #

public const string SecurityTxtPath = "/.well-known/security.txt"

The path of the security contact document.

constant SupportLifecyclePath #

public const string SupportLifecyclePath = "/api/v1/product/support-lifecycle"

The path of the support lifecycle document.

method IsHealthPath(PathString) #

public static bool IsHealthPath(PathString path)

Whether the path is a health path: it starts with /health.

Parameters

  • path: The request path.

Returns

true for a health path.

method IsMetricsPath(PathString) #

public static bool IsMetricsPath(PathString path)

Whether the path is /metrics.

Parameters

  • path: The request path.

Returns

true for the metrics path.

method IsOperatorVerifyPath(PathString) #

public static bool IsOperatorVerifyPath(PathString path)

Whether the path is an operator verification path.

Parameters

  • path: The request path.

Returns

true for an operator verification path.

method IsSystemPath(PathString) #

public static bool IsSystemPath(PathString path)

Whether the gateway answers the path itself and never routes it to a microservice.

Parameters

  • path: The request path.

Returns

true for a system path.

class HealthCheckMiddleware

public sealed class HealthCheckMiddleware

Answers the gateway health and metrics paths.

Members

MemberKindSummary
HealthCheckMiddleware(RequestDelegate)constructorCreates the middleware.
InvokeAsync(HttpContext, GatewayServiceStatus, GatewayMetrics, GatewayReadinessEvaluator)methodAnswers /metrics with the Prometheus text and /health, /health/live, /health/ready and /health/startup with the gateway status; /health/ready answers 503 until the gateway is ready, and /health/startup 503 until it has started.

constructor HealthCheckMiddleware(RequestDelegate) #

public HealthCheckMiddleware(RequestDelegate next)

Creates the middleware.

Parameters

  • next: The next middleware.

method InvokeAsync(HttpContext, GatewayServiceStatus, GatewayMetrics, GatewayReadinessEvaluator) #

public Task InvokeAsync(HttpContext context, GatewayServiceStatus status, GatewayMetrics metrics, GatewayReadinessEvaluator readinessEvaluator)

Answers /metrics with the Prometheus text and /health, /health/live, /health/ready and /health/startup with the gateway status; /health/ready answers 503 until the gateway is ready, and /health/startup 503 until it has started. Every other request passes on.

Parameters

  • context: The HTTP context.
  • status: The gateway status.
  • metrics: The gateway metrics.
  • readinessEvaluator: Evaluates the readiness.

Returns

A task that completes when the request is handled.

class RequestRoutingMiddleware

public sealed class RequestRoutingMiddleware

Dispatches a routed request to a microservice instance.

Members

MemberKindSummary
RequestRoutingMiddleware(RequestDelegate, ILogger<RequestRoutingMiddleware>, ILogger<TransportDispatchMiddleware>, IHostEnvironment, IOptions<PayloadLimits>)constructorCreates the middleware.
InvokeAsync(HttpContext, ITransportClient, IGlobalRoutingState, IRouterGatewayMetrics)methodDispatches the request to an instance of the resolved endpoint over its transport and writes the response.

constructor RequestRoutingMiddleware(RequestDelegate, ILogger<RequestRoutingMiddleware>, ILogger<TransportDispatchMiddleware>, IHostEnvironment, IOptions<PayloadLimits>) #

public RequestRoutingMiddleware(RequestDelegate next, ILogger<RequestRoutingMiddleware> logger, ILogger<TransportDispatchMiddleware> dispatchLogger, IHostEnvironment environment, IOptions<PayloadLimits> limits)

Creates the middleware.

Parameters

  • next: The next middleware.
  • logger: Receives the diagnostics.
  • dispatchLogger: Receives the dispatch diagnostics.
  • environment: The host environment.
  • limits: The payload limits.

method InvokeAsync(HttpContext, ITransportClient, IGlobalRoutingState, IRouterGatewayMetrics) #

public Task InvokeAsync(HttpContext context, ITransportClient transportClient, IGlobalRoutingState routingState, IRouterGatewayMetrics metrics)

Dispatches the request to an instance of the resolved endpoint over its transport and writes the response.

Parameters

  • context: The HTTP context.
  • transportClient: Sends the request frame.
  • routingState: The connected instances.
  • metrics: Records the request.

Returns

A task that completes when the request is handled.

namespace StellaOps.Router.Gateway.Hosting.Routing

TypeKindDescription
StellaOpsRouteResolverclassResolves a request path to a configured static route.

class StellaOpsRouteResolver

public sealed class StellaOpsRouteResolver

Resolves a request path to a configured static route.

Members

MemberKindSummary
StellaOpsRouteResolver(IEnumerable<StellaOpsRoute>)constructorCreates a resolver over routes, tried in order.
FindSpaFallbackRoute()methodFinds the StaticFiles route configured with x-spa-fallback: true.
MatchRoutePattern(StellaOpsRoute, string)methodMatches pathValue against the compiled pattern of a regex route this resolver returned from StellaOpsRouteResolver.Resolve(PathString), so a second form of the same request (the raw wire path) can be translated with the same captures.
Resolve(PathString)methodReturns the first route that matches the path: a regex route by its pattern, any other route by its path or a path below it, ignoring case.

constructor StellaOpsRouteResolver(IEnumerable<StellaOpsRoute>) #

public StellaOpsRouteResolver(IEnumerable<StellaOpsRoute> routes)

Creates a resolver over routes, tried in order.

Parameters

  • routes: The routes.

method FindSpaFallbackRoute() #

public StellaOpsRoute? FindSpaFallbackRoute()

Finds the StaticFiles route configured with x-spa-fallback: true. Used to serve index.html for browser navigation requests that would otherwise be intercepted by ReverseProxy routes.

method MatchRoutePattern(StellaOpsRoute, string) #

public Match? MatchRoutePattern(StellaOpsRoute route, string pathValue)

Matches pathValue against the compiled pattern of a regex route this resolver returned from StellaOpsRouteResolver.Resolve(PathString), so a second form of the same request (the raw wire path) can be translated with the same captures. Null for a non-regex route, a route this resolver does not own, or a miss.

method Resolve(PathString) #

public (StellaOpsRoute? Route, Match? RegexMatch) Resolve(PathString path)

Returns the first route that matches the path: a regex route by its pattern, any other route by its path or a path below it, ignoring case.

Parameters

  • path: The request path.

Returns

The route and, for a regex route, its match; both null when no route matches.

namespace StellaOps.Router.Gateway.Hosting.Services

TypeKindDescription
GatewayHealthMonitorServiceclassChecks the connected instances at the check interval and marks those without a recent heartbeat degraded or stale.
GatewayHostedServiceclassRuns the gateway transport servers and handles the frames microservices send: HELLO, heartbeats, responses and cancellations.
GatewayMetricsclassThe gateway’s connection and routing-weight gauges, on the meter GatewayMetrics.MeterName, and the Prometheus text of the /metrics endpoint.
GatewayReadinessEvaluatorclassEvaluates GatewayReadinessReport.
GatewayReadinessReportrecordThe gateway’s readiness: started, transports ready, and every service named in Gateway:Health:RequiredMicroservices connected with a healthy or degraded instance.
GatewayRegistrationResyncRequestrecordThe body of an endpoint metadata replay request.
GatewayRegistrationResyncResultrecordThe result of an endpoint metadata replay request.
GatewayRegistrationResyncServiceclassAsks connected microservices to replay their endpoint metadata.
GatewayServiceStatusclassThe started and ready flags of the gateway, which the health endpoints report.
GatewayTransportClientclassSends frames to microservices over the transport of each connection and pairs the responses with the pending requests.
IGatewayHealthContributorinterfaceA section a host adds to the gateway’s health response (/health, /health/live, /health/ready and /health/startup).
IGatewayTransportClientinterfaceSends frames to microservices over the transport of each connection and pairs the responses with the pending requests.

class GatewayHealthMonitorService

public sealed class GatewayHealthMonitorService : BackgroundService

Checks the connected instances at the check interval and marks those without a recent heartbeat degraded or stale.

Members

MemberKindSummary
GatewayHealthMonitorService(IGlobalRoutingState, IOptions<HealthOptions>, ILogger<GatewayHealthMonitorService>)constructorCreates the monitor.

constructor GatewayHealthMonitorService(IGlobalRoutingState, IOptions<HealthOptions>, ILogger<GatewayHealthMonitorService>) #

public GatewayHealthMonitorService(IGlobalRoutingState routingState, IOptions<HealthOptions> options, ILogger<GatewayHealthMonitorService> logger)

Creates the monitor.

Parameters

  • routingState: The connected instances.
  • options: The health thresholds and check interval.
  • logger: Receives the diagnostics.

class GatewayHostedService

public sealed class GatewayHostedService : IHostedService

Runs the gateway transport servers and handles the frames microservices send: HELLO, heartbeats, responses and cancellations.

Members

MemberKindSummary
GatewayHostedService(IGlobalRoutingState, IGatewayTransportClient, GatewayRegistrationResyncService, IEffectiveClaimsStore, IOptions<GatewayOptions>, GatewayServiceStatus, ILogger<GatewayHostedService>, IEnumerable<IGatewayConnectionTransportServer>, IGatewayMessagingTransportServer, IRouterOpenApiDocumentCache)constructorCreates the service.
StartAsync(CancellationToken)methodStarts the enabled transport servers and marks the gateway started and ready.
StopAsync(CancellationToken)methodMarks the gateway not ready and stops the transport servers.

constructor GatewayHostedService(IGlobalRoutingState, IGatewayTransportClient, GatewayRegistrationResyncService, IEffectiveClaimsStore, IOptions<GatewayOptions>, GatewayServiceStatus, ILogger<GatewayHostedService>, IEnumerable<IGatewayConnectionTransportServer>, IGatewayMessagingTransportServer, IRouterOpenApiDocumentCache) #

public GatewayHostedService(IGlobalRoutingState routingState, IGatewayTransportClient transportClient, GatewayRegistrationResyncService registrationResyncService, IEffectiveClaimsStore claimsStore, IOptions<GatewayOptions> options, GatewayServiceStatus status, ILogger<GatewayHostedService> logger, IEnumerable<IGatewayConnectionTransportServer>? connectionTransportServers = null, IGatewayMessagingTransportServer? messagingServer = null, IRouterOpenApiDocumentCache? openApiCache = null)

Creates the service.

Parameters

  • routingState: The connected instances.
  • transportClient: Sends frames.
  • registrationResyncService: Requests endpoint replays.
  • claimsStore: The effective claim requirements.
  • options: The gateway options.
  • status: The gateway status.
  • logger: Receives the diagnostics.
  • connectionTransportServers: The connection-oriented transport servers.
  • messagingServer: The messaging transport server, when there is one.
  • openApiCache: The OpenAPI document cache, when there is one.

method StartAsync(CancellationToken) #

public Task StartAsync(CancellationToken cancellationToken)

Starts the enabled transport servers and marks the gateway started and ready.

Parameters

  • cancellationToken: Cancels the start.

Returns

A task that completes when the servers started.

method StopAsync(CancellationToken) #

public Task StopAsync(CancellationToken cancellationToken)

Marks the gateway not ready and stops the transport servers.

Parameters

  • cancellationToken: Cancels the stop.

Returns

A task that completes when the servers stopped.

class GatewayMetrics

public sealed class GatewayMetrics

The gateway’s connection and routing-weight gauges, on the meter GatewayMetrics.MeterName, and the Prometheus text of the /metrics endpoint.

Members

MemberKindSummary
GatewayMetrics(IGlobalRoutingState, IRouterGatewayMetrics, IRoutingWeightOverrideStore)constructorCreates the metrics.
MeterNameconstantThe name of the meter that carries the gateway gauges.
GetActiveConnections()methodThe number of connected instances.
GetRegisteredEndpoints()methodThe number of endpoints the connected instances announce.
ToPrometheusText()methodThe Prometheus text exposition of the gateway gauges and request metrics.

constructor GatewayMetrics(IGlobalRoutingState, IRouterGatewayMetrics, IRoutingWeightOverrideStore) #

public GatewayMetrics(IGlobalRoutingState routingState, IRouterGatewayMetrics routerMetrics, IRoutingWeightOverrideStore weightOverrides)

Creates the metrics.

Parameters

  • routingState: The connected instances.
  • routerMetrics: The router request metrics.
  • weightOverrides: The routing weight overrides.

constant MeterName #

public const string MeterName = "StellaOps.Router.Gateway.Hosting"

The name of the meter that carries the gateway gauges.

method GetActiveConnections() #

public long GetActiveConnections()

The number of connected instances.

Returns

The number of connections.

method GetRegisteredEndpoints() #

public long GetRegisteredEndpoints()

The number of endpoints the connected instances announce.

Returns

The number of endpoints.

method ToPrometheusText() #

public string ToPrometheusText()

The Prometheus text exposition of the gateway gauges and request metrics.

Returns

The metrics text.

class GatewayReadinessEvaluator

public sealed class GatewayReadinessEvaluator

Evaluates GatewayReadinessReport. A required name and a connected instance match when their keys are equal, ignoring case: the key is the service name (or the instance identifier without a trailing -<number>) without a :port part and without the endings listed in Gateway:Health:ServiceNameSuffixes, each removed once, in order.

Members

MemberKindSummary
GatewayReadinessEvaluator(IGlobalRoutingState, IOptions<GatewayOptions>)constructorCreates the evaluator.
Evaluate(GatewayServiceStatus)methodEvaluates the readiness of the gateway.

constructor GatewayReadinessEvaluator(IGlobalRoutingState, IOptions<GatewayOptions>) #

public GatewayReadinessEvaluator(IGlobalRoutingState routingState, IOptions<GatewayOptions> options)

Creates the evaluator.

Parameters

  • routingState: The connected instances.
  • options: The gateway options with the required services.

method Evaluate(GatewayServiceStatus) #

public GatewayReadinessReport Evaluate(GatewayServiceStatus status)

Evaluates the readiness of the gateway.

Parameters

  • status: The gateway status.

Returns

The readiness report.

record GatewayReadinessReport

public sealed record GatewayReadinessReport

The gateway’s readiness: started, transports ready, and every service named in Gateway:Health:RequiredMicroservices connected with a healthy or degraded instance.

Members

MemberKindSummary
GatewayReadinessReport()constructorCreates an instance of GatewayReadinessReport.
IsReadypropertyWhether the gateway is ready: started, transports ready and every required service connected.
MissingMicroservicespropertyThe required services without a healthy or degraded instance.
RequiredMicroservicespropertyThe services readiness requires.
StartedpropertyWhether the gateway has started.
TransportReadypropertyWhether the transport servers are ready.

constructor GatewayReadinessReport() #

public GatewayReadinessReport()

Creates an instance of GatewayReadinessReport.

property IsReady #

public required bool IsReady { get; init; }

Whether the gateway is ready: started, transports ready and every required service connected.

property MissingMicroservices #

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

The required services without a healthy or degraded instance.

property RequiredMicroservices #

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

The services readiness requires.

property Started #

public required bool Started { get; init; }

Whether the gateway has started.

property TransportReady #

public required bool TransportReady { get; init; }

Whether the transport servers are ready.

record GatewayRegistrationResyncRequest

public sealed record GatewayRegistrationResyncRequest

The body of an endpoint metadata replay request.

Parameters

  • ConnectionId: The connection to replay; every connection when not set.
  • Reason: Why the replay is requested; administration-request when not set.

Members

MemberKindSummary
GatewayRegistrationResyncRequest(string, string)constructorThe body of an endpoint metadata replay request.
ConnectionIdpropertyThe connection to replay; every connection when not set.
ReasonpropertyWhy the replay is requested; administration-request when not set.

constructor GatewayRegistrationResyncRequest(string, string) #

public GatewayRegistrationResyncRequest(string? ConnectionId, string? Reason)

The body of an endpoint metadata replay request.

Parameters

  • ConnectionId: The connection to replay; every connection when not set.
  • Reason: Why the replay is requested; administration-request when not set.

property ConnectionId #

public string? ConnectionId { get; init; }

The connection to replay; every connection when not set.

property Reason #

public string? Reason { get; init; }

Why the replay is requested; administration-request when not set.

record GatewayRegistrationResyncResult

public sealed record GatewayRegistrationResyncResult

The result of an endpoint metadata replay request.

Members

MemberKindSummary
GatewayRegistrationResyncResult()constructorCreates an instance of GatewayRegistrationResyncResult.
ConnectionIdpropertyThe requested connection; not set when every connection was asked.
MatchedCountpropertyThe connections the request matched.
ReasonpropertyWhy the replay was requested.
RequestedCountpropertyThe connections asked to replay their endpoints.
SkippedCountpropertyThe connections skipped because they were asked less than 15 seconds before, without force.

constructor GatewayRegistrationResyncResult() #

public GatewayRegistrationResyncResult()

Creates an instance of GatewayRegistrationResyncResult.

property ConnectionId #

public string? ConnectionId { get; init; }

The requested connection; not set when every connection was asked.

property MatchedCount #

public int MatchedCount { get; init; }

The connections the request matched.

property Reason #

public required string Reason { get; init; }

Why the replay was requested.

property RequestedCount #

public int RequestedCount { get; init; }

The connections asked to replay their endpoints.

property SkippedCount #

public int SkippedCount { get; init; }

The connections skipped because they were asked less than 15 seconds before, without force.

class GatewayRegistrationResyncService

public sealed class GatewayRegistrationResyncService

Asks connected microservices to replay their endpoint metadata.

Members

MemberKindSummary
GatewayRegistrationResyncService(IGlobalRoutingState, IGatewayTransportClient, TimeProvider, ILogger<GatewayRegistrationResyncService>)constructorCreates the service.
ClearPending(string)methodForgets when a connection was last asked, so it can be asked again at once.
RequestResyncAsync(string, string, bool, CancellationToken)methodAsks one connection, or every connection when connectionId is not set, to replay its endpoint metadata.

constructor GatewayRegistrationResyncService(IGlobalRoutingState, IGatewayTransportClient, TimeProvider, ILogger<GatewayRegistrationResyncService>) #

public GatewayRegistrationResyncService(IGlobalRoutingState routingState, IGatewayTransportClient transportClient, TimeProvider timeProvider, ILogger<GatewayRegistrationResyncService> logger)

Creates the service.

Parameters

  • routingState: The connected instances.
  • transportClient: Sends the replay requests.
  • timeProvider: The clock.
  • logger: Receives the diagnostics.

method ClearPending(string) #

public void ClearPending(string connectionId)

Forgets when a connection was last asked, so it can be asked again at once.

Parameters

  • connectionId: The connection.

method RequestResyncAsync(string, string, bool, CancellationToken) #

public Task<GatewayRegistrationResyncResult> RequestResyncAsync(string? connectionId, string reason, bool force, CancellationToken cancellationToken)

Asks one connection, or every connection when connectionId is not set, to replay its endpoint metadata. Without force, a connection asked less than 15 seconds before is skipped.

Parameters

  • connectionId: The connection; every connection when not set.
  • reason: Why the replay is requested.
  • force: Whether to ask a connection that was asked recently.
  • cancellationToken: Cancels the requests.

Returns

How many connections matched, were asked and were skipped.

class GatewayServiceStatus

public sealed class GatewayServiceStatus

The started and ready flags of the gateway, which the health endpoints report.

Members

MemberKindSummary
GatewayServiceStatus()constructorCreates an instance of GatewayServiceStatus.
IsReadypropertyWhether the gateway is ready to route requests.
IsStartedpropertyWhether the gateway has started.
MarkNotReady()methodMarks the gateway not ready, for example while it stops.
MarkReady()methodMarks the gateway ready.
MarkStarted()methodMarks the gateway started.

constructor GatewayServiceStatus() #

public GatewayServiceStatus()

Creates an instance of GatewayServiceStatus.

property IsReady #

public bool IsReady { get; }

Whether the gateway is ready to route requests.

property IsStarted #

public bool IsStarted { get; }

Whether the gateway has started.

method MarkNotReady() #

public void MarkNotReady()

Marks the gateway not ready, for example while it stops.

method MarkReady() #

public void MarkReady()

Marks the gateway ready.

method MarkStarted() #

public void MarkStarted()

Marks the gateway started.

class GatewayTransportClient

public sealed class GatewayTransportClient : IGatewayTransportClient

Sends frames to microservices over the transport of each connection and pairs the responses with the pending requests.

Members

MemberKindSummary
GatewayTransportClient(ILogger<GatewayTransportClient>, IEnumerable<IGatewayConnectionTransportServer>, IGatewayMessagingTransportServer)constructorCreates the client over the transport servers the gateway runs.
HandleResponseFrame(Frame)methodCompletes the pending request that a response frame answers, by its correlation id.
SendCancelAsync(ConnectionState, Guid, string)methodSends a cancellation request.
SendFrameAsync(ConnectionState, Frame, CancellationToken)methodSends a frame to the microservice of a connection, without waiting for a response.
SendRequestAsync(ConnectionState, Frame, TimeSpan, CancellationToken)methodSends a request and waits for a response.
SendStreamingAsync(ConnectionState, Frame, Stream, Func<ResponseFrame, Stream, Task>, PayloadLimits, CancellationToken)methodSends the request body in one request frame and hands the microservice’s response head and body to readResponse (TransportStreamingDispatch.SendBufferedAsync(ITransportClient, ConnectionState, Frame, Stream, Func<ResponseFrame, Stream, Task>, PayloadLimits, CancellationToken)).

constructor GatewayTransportClient(ILogger<GatewayTransportClient>, IEnumerable<IGatewayConnectionTransportServer>, IGatewayMessagingTransportServer) #

public GatewayTransportClient(ILogger<GatewayTransportClient> logger, IEnumerable<IGatewayConnectionTransportServer>? connectionTransportServers = null, IGatewayMessagingTransportServer? messagingServer = null)

Creates the client over the transport servers the gateway runs.

Parameters

  • logger: Receives the diagnostics.
  • connectionTransportServers: The connection-oriented transport servers.
  • messagingServer: The messaging transport server, when there is one.

method HandleResponseFrame(Frame) #

public void HandleResponseFrame(Frame frame)

Completes the pending request that a response frame answers, by its correlation id.

Parameters

  • frame: The response frame.

method SendCancelAsync(ConnectionState, Guid, string) #

public 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 SendFrameAsync(ConnectionState, Frame, CancellationToken) #

public Task SendFrameAsync(ConnectionState connection, Frame frame, CancellationToken cancellationToken)

Sends a frame to the microservice of a connection, without waiting for a response.

Parameters

  • connection: The connection.
  • frame: The frame.
  • cancellationToken: Cancels the send.

Returns

A task that completes when the frame is sent.

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

public 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) #

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

Sends the request body in one request frame and hands the microservice’s response head and body to readResponse (TransportStreamingDispatch.SendBufferedAsync(ITransportClient, ConnectionState, Frame, Stream, Func<ResponseFrame, Stream, Task>, PayloadLimits, CancellationToken)). The Microservice SDK answers a request with one response frame and does not assemble request stream-data frames, so the request is not sent in chunks.

interface IGatewayHealthContributor

public interface IGatewayHealthContributor

A section a host adds to the gateway’s health response (/health, /health/live, /health/ready and /health/startup). Each registered contributor adds one property after missingMicroservices, in registration order. A section is informational: the status code of the response never depends on it.

Members

MemberKindSummary
NamepropertyThe property name of the section in the health response.
Describe()methodThe value of the section, written with the response’s JSON options (camel-case property names).

property Name #

string Name { get; }

The property name of the section in the health response. It must be unique among the contributors and must not be one of the response’s own properties (status, started, ready, transportReady, requiredMicroservices, missingMicroservices, traceId, licence).

method Describe() #

object Describe()

The value of the section, written with the response’s JSON options (camel-case property names). Called for every health request.

interface IGatewayTransportClient

public interface IGatewayTransportClient : ITransportClient

Sends frames to microservices over the transport of each connection and pairs the responses with the pending requests.

Members

MemberKindSummary
HandleResponseFrame(Frame)methodCompletes the pending request that a response frame answers, by its correlation id.
SendFrameAsync(ConnectionState, Frame, CancellationToken)methodSends a frame to the microservice of a connection, without waiting for a response.

method HandleResponseFrame(Frame) #

void HandleResponseFrame(Frame frame)

Completes the pending request that a response frame answers, by its correlation id.

Parameters

  • frame: The response frame.

method SendFrameAsync(ConnectionState, Frame, CancellationToken) #

Task SendFrameAsync(ConnectionState connection, Frame frame, CancellationToken cancellationToken)

Sends a frame to the microservice of a connection, without waiting for a response.

Parameters

  • connection: The connection.
  • frame: The frame.
  • cancellationToken: Cancels the send.

Returns

A task that completes when the frame is sent.