StellaOps.Router.Transport.Messaging.Server

Router Messaging transport, server side: the gateway request and response queues over a Messaging backend.

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.Transport.Messaging.Server --version 1.0.1-20261117T070237Z

Namespaces

NamespaceTypes
StellaOps.Router.Transport.Messaging.Server3

namespace StellaOps.Router.Transport.Messaging.Server

TypeKindDescription
MessagingTransportServerclassTransport server that receives requests from microservices via StellaOps.Messaging.
MessagingTransportServerPluginclassPlugin for the server side of the Messaging transport, which a gateway serves the request and response queues with.
MessagingTransportServerServiceCollectionExtensionsclassExtension methods for registering the server side of the messaging transport.

class MessagingTransportServer

public sealed class MessagingTransportServer : IGatewayMessagingTransportServer, IDisposable

Transport server that receives requests from microservices via StellaOps.Messaging. Used by the Gateway to handle incoming RPC calls.

Members

MemberKindSummary
MessagingTransportServer(IMessageQueueFactory, IOptions<MessagingTransportOptions>, ILogger<MessagingTransportServer>, IFrameEnvelopeVerifier, IFrameEnvelopeSigner)constructorInitializes a new instance of the MessagingTransportServerclass.
OnConnectionClosedeventEvent raised when a connection is closed.
OnEndpointsUpdatedeventEvent raised when a microservice replays endpoint metadata after a router resync request.
OnHeartbeatReceivedeventEvent raised when a HEARTBEAT frame is received.
OnHelloReceivedeventEvent raised when a HELLO frame is received.
OnResponseReceivedeventEvent raised when a RESPONSE frame is received.
Dispose()methodSee IDisposable.Dispose().
GetConnection(string)methodGets a connection by ID.
SendToMicroserviceAsync(string, Frame, CancellationToken)methodSends a request frame to a microservice via messaging.
StartAsync(CancellationToken)methodStarts listening for incoming connections.
StopAsync(CancellationToken)methodStops accepting new connections.

constructor MessagingTransportServer(IMessageQueueFactory, IOptions<MessagingTransportOptions>, ILogger<MessagingTransportServer>, IFrameEnvelopeVerifier, IFrameEnvelopeSigner) #

public MessagingTransportServer(IMessageQueueFactory queueFactory, IOptions<MessagingTransportOptions> options, ILogger<MessagingTransportServer> logger, IFrameEnvelopeVerifier? envelopeVerifier = null, IFrameEnvelopeSigner? envelopeSigner = null)

Initializes a new instance of the MessagingTransportServerclass.

event OnConnectionClosed #

public event Func<string, Task>? OnConnectionClosed

Event raised when a connection is closed.

event OnEndpointsUpdated #

public event Func<ConnectionState, EndpointsUpdatePayload, Task>? OnEndpointsUpdated

Event raised when a microservice replays endpoint metadata after a router resync request.

event OnHeartbeatReceived #

public event Func<ConnectionState, HeartbeatPayload, Task>? OnHeartbeatReceived

Event raised when a HEARTBEAT frame is received.

event OnHelloReceived #

public event Func<ConnectionState, HelloPayload, Task>? OnHelloReceived

Event raised when a HELLO frame is received.

event OnResponseReceived #

public event Func<ConnectionState, Frame, Task>? OnResponseReceived

Event raised when a RESPONSE frame is received.

method Dispose() #

public void Dispose()

See IDisposable.Dispose().

method GetConnection(string) #

public ConnectionState? GetConnection(string connectionId)

Gets a connection by ID.

method SendToMicroserviceAsync(string, Frame, CancellationToken) #

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

Sends a request frame to a microservice via messaging.

method StartAsync(CancellationToken) #

public Task StartAsync(CancellationToken cancellationToken)

Starts listening for incoming connections.

Parameters

  • cancellationToken: Cancellation token.

method StopAsync(CancellationToken) #

public Task StopAsync(CancellationToken cancellationToken)

Stops accepting new connections.

Parameters

  • cancellationToken: Cancellation token.

Remarks

A host can stop the server twice at once, for example its own shutdown and the caller’s StopAsync of a test host. Every caller waits for the one stop, so no caller goes on to dispose the Messaging backend while the processing loops still acknowledge leases.

class MessagingTransportServerPlugin

public sealed class MessagingTransportServerPlugin : IRouterTransportPlugin

Plugin for the server side of the Messaging transport, which a gateway serves the request and response queues with. The client side is MessagingTransportPluginin StellaOps.Router.Transport.Messaging; both carry the transport name messaging.

Members

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

constructor MessagingTransportServerPlugin() #

public MessagingTransportServerPlugin()

Creates an instance of MessagingTransportServerPlugin.

property DisplayName #

public string DisplayName { get; }

Gets the human-readable display name for this transport.

property Mode #

public RouterTransportMode Mode { get; }

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

property TransportName #

public string TransportName { get; }

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

method Register(RouterTransportRegistrationContext) #

public void Register(RouterTransportRegistrationContext context)

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

Parameters

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

Exceptions

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

class MessagingTransportServerServiceCollectionExtensions

public static class MessagingTransportServerServiceCollectionExtensions

Extension methods for registering the server side of the messaging transport.

Members

MemberKindSummary
AddMessagingTransportServer(IServiceCollection, Action<MessagingTransportOptions>)extension methodAdds the messaging transport server only (for Gateway).

extension method AddMessagingTransportServer(IServiceCollection, Action<MessagingTransportOptions>) #

public static IServiceCollection AddMessagingTransportServer(this IServiceCollection services, Action<MessagingTransportOptions>? configure = null)

Adds the messaging transport server only (for Gateway). Requires StellaOps.Messaging services to be registered.

Parameters

  • services: The service collection.
  • configure: Optional configuration action.

Returns

The service collection for chaining.