API reference — Operations

Nuvora.Nexus.Relay.Management.Agent

In-process agent that registers a Nuvora Nexus Relay service with the management control plane and pushes heartbeats, metrics and subsystem snapshots.

dotnet add package Nuvora.Nexus.Relay.Management.Agent

Nuvora.Nexus.Relay.Management.Agent

ManagementAgentOptions

public sealed class ManagementAgentOptions

Configures the management agent: which control plane to report to, this node’s identity, and how much detail each snapshot carries.

Properties

List<string> Capabilities { get; set; }

Subsystem capabilities to advertise. Auto-detected from DI when left empty.

List<string> PublishedEventTypes { get; set; }

Integration-event type names this service publishes (drives the outbound edges of the topology graph). Subscribed events are auto-detected from the integration-event registry.

List<string> Transports { get; set; }

Transports to advertise. When empty the agent leaves it to the UI to infer.

bool EnableRemoteActions { get; set; }

When false, the agent reports but refuses remote actions. Defaults to false (fail-closed): the control-callback /actions endpoint performs destructive operations, so it stays disabled until an operator opts in — and, when enabled, until authentication is configured (see ManagementAgentOptions.ApiKey / ManagementAgentOptions.AuthorizationPolicy). With no auth configured, destructive actions are refused with 403 even when this is true.

int DeadLetterSampleSize { get; set; }

Max dead-letter rows sampled per source per snapshot.

int HeartbeatIntervalSeconds { get; set; }

Seconds between heartbeats (the server may override on registration).

int PayloadMaxChars { get; set; }

Max characters of a dead-letter payload to forward (truncated beyond this).

int SagaSampleSize { get; set; }

Max saga instances sampled per snapshot.

int SnapshotIntervalSeconds { get; set; }

Seconds between full snapshots (the server may override on registration).

string ApiKeyHeader { get; set; }

Request header carrying ManagementAgentOptions.ApiKey. Defaults to X-Relay-Management-Key.

string ManagementUrl { get; set; }

Base URL of the management control plane (e.g. “http://relay-management:8080”). Required.

string ServiceName { get; set; }

Logical service name this node belongs to (e.g. “orders-service”). Required.

string? ApiKey { get; set; }

Optional shared-secret API key required on the control-callback endpoints. When set, every request must present the key in the ManagementAgentOptions.ApiKeyHeader header; it is compared constant-time (see ManagementAuth.MatchesApiKey). Leave null to rely on ManagementAgentOptions.AuthorizationPolicy instead, or to run observe-only with remote actions disabled.

string? AuthorizationPolicy { get; set; }

Optional ASP.NET Core authorization policy name applied to the control-callback endpoints via RequireAuthorization. When set, callers must satisfy this policy (e.g. a bearer token). May be combined with ManagementAgentOptions.ApiKey; either mechanism configured counts as “authenticated”.

string? ControlBaseUrl { get; set; }

Public base URL the control plane can call back for remote actions (e.g. “http://orders-service:8080”). Leave null to run observe-only (no remote actions).

string? DatabaseName { get; set; }

Database name to display (the service’s own DB). Surfaced in the durability monitor.

string? Environment { get; set; }

Deployment environment label surfaced in the UI.

string? NodeId { get; set; }

Stable node identity. Defaults to “{MachineName}:{pid}” so a restart keeps the same row.

RelayManagementAgent

public sealed class RelayManagementAgent : BackgroundService

Background service that connects this node to the management control plane: registers on start, then runs a heartbeat loop and a snapshot loop until shutdown. Network failures are tolerated — the agent retries registration and never throws into the host.

Constructors

RelayManagementAgent(IHttpClientFactory httpClientFactory, SnapshotBuilder snapshots, IOptions<ManagementAgentOptions> options, ILogger<RelayManagementAgent> logger, HealthCheckService? health = null)

Methods

override Task ExecuteAsync(CancellationToken stoppingToken)

This method is called when the IHostedService starts. The implementation should return a task that represents the lifetime of the long running operation(s) being performed.

override void Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Fields

const string HttpClientName = "relay-management"

Nuvora.Nexus.Relay.Management.Agent.DependencyInjection

ManagementAgentServiceCollectionExtensions

public static class ManagementAgentServiceCollectionExtensions

Registration helpers for the management agent.

Methods

static IServiceCollection AddRelayManagementAgent(this IServiceCollection services, Action<ManagementAgentOptions> configure)

Registers the management agent: a metrics collector, snapshot builder, action executor, the reporting RelayManagementAgent hosted service, and a named HttpClient. Map the control-callback endpoints with MapRelayManagementAgent().

Nuvora.Nexus.Relay.Management.Agent.Endpoints

ManagementAgentEndpoints

public static class ManagementAgentEndpoints

Maps the control-callback endpoints the management plane invokes on this node.

Methods

static IEndpointRouteBuilder MapRelayManagementAgent(this IEndpointRouteBuilder endpoints, string prefix = "/relay-agent")

Maps POST {prefix}/actions (perform a remote action) and GET {prefix}/ping under the given prefix (default /relay-agent). The node advertises its base URL via ManagementAgentOptions.ControlBaseUrl so the plane can reach these.

Nuvora.Nexus.Relay.Management.Agent.Internals

ManagementActionExecutor

public sealed class ManagementActionExecutor

Performs operator actions the control plane proxies to this node, delegating to the relevant Relay repository/manager. Each action resolves its dependency in a fresh scope and is a no-op (with a clear message) when the subsystem isn’t wired up.

Constructors

ManagementActionExecutor(IServiceProvider services, IOptions<ManagementAgentOptions> options, ILogger<ManagementActionExecutor> logger)

Methods

Task<ActionResult> ExecuteAsync(ActionRequest request, CancellationToken ct)

MetricsCollector

public sealed class MetricsCollector : IDisposable

Captures the Relay meter’s measurements in-process via a MeterListener. The framework’s instruments are write-only (OpenTelemetry export), so this is the only way to read current values inside the app: counters accumulate cumulatively, observable gauges are pulled on demand, and histograms are summarised over each snapshot window.

Constructors

MetricsCollector()

Methods

MetricsSnapshot Capture()

Builds a snapshot of all captured metrics. Pulls fresh observable-gauge values, then drains the histogram windows so each summary covers the interval since the previous call.

void Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

SnapshotBuilder

public sealed class SnapshotBuilder

Assembles a RelaySnapshot by querying whichever Relay subsystems are registered in DI. Every collector is wrapped so one failing subsystem never sinks the whole snapshot.

Constructors

SnapshotBuilder(IServiceProvider services, MetricsCollector metrics, IOptions<ManagementAgentOptions> options, ILogger<SnapshotBuilder> logger)

Methods

IReadOnlyList<string> DetectCapabilities()

Capabilities advertised at registration, inferred from which subsystems are wired up.

Task<RelaySnapshot> BuildAsync(string nodeKey, CancellationToken ct)