StellaOps.Router.Transport.Messaging.Server

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

PackageStellaOps.Router.Transport.Messaging.Server
ComponentRouter
LicenceBUSL-1.1 (Router licence)
Package kindLibrary
Target frameworknet10.0

To add the package to a project, see Installing Stella Ops packages.

Namespaces

NamespaceTypes
StellaOps.Router.Transport.Messaging.Server3

StellaOps.Router.Transport.Messaging.Server namespace

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.

MessagingTransportServer class

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.

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

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

Initializes a new instance of the MessagingTransportServerclass.

OnConnectionClosed event

public event Func<string, Task>? OnConnectionClosed

Event raised when a connection is closed.

OnEndpointsUpdated event

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

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

OnHeartbeatReceived event

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

Event raised when a HEARTBEAT frame is received.

OnHelloReceived event

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

Event raised when a HELLO frame is received.

OnResponseReceived event

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

Event raised when a RESPONSE frame is received.

Dispose() method

public void Dispose()

See IDisposable.Dispose().

GetConnection(string) method

public ConnectionState? GetConnection(string connectionId)

Gets a connection by ID.

SendToMicroserviceAsync(string, Frame, CancellationToken) method

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

Sends a request frame to a microservice via messaging.

StartAsync(CancellationToken) method

public Task StartAsync(CancellationToken cancellationToken)

Starts listening for incoming connections.

Parameters

StopAsync(CancellationToken) method

public Task StopAsync(CancellationToken cancellationToken)

Stops accepting new connections.

Parameters

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.

MessagingTransportServerPlugin class

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.

MessagingTransportServerPlugin() constructor

public MessagingTransportServerPlugin()

Creates an instance of MessagingTransportServerPlugin.

DisplayName property

public string DisplayName { get; }

Gets the human-readable display name for this transport.

Mode property

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)).

TransportName property

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.

Register(RouterTransportRegistrationContext) method

public void Register(RouterTransportRegistrationContext context)

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

Parameters

Exceptions

MessagingTransportServerServiceCollectionExtensions class

public static class MessagingTransportServerServiceCollectionExtensions

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

AddMessagingTransportServer(IServiceCollection, Action<MessagingTransportOptions>) extension method

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

Returns

The service collection for chaining.