Table of Contents

Class ApiEventSchemaRegistration

Namespace
Virtufin.Api.Services
Assembly
Virtufin.Api.dll

Registers the gateway's own event payloads (All) in its payload schema registry when it starts, as every producer does (openspec api-gateway, Payload Schema Registry), so clients decode the state, trigger and topic catalog events through it. In the background: it never delays the gateway's start. The registry's store goes through the Dapr sidecar, which usually accepts connections only after the gateway has started, so a failed registration is retried every RetryDelay until all of them are registered.

public sealed class ApiEventSchemaRegistration : BackgroundService, IHostedService, IDisposable
Inheritance
ApiEventSchemaRegistration
Implements
Inherited Members

Constructors

ApiEventSchemaRegistration(PayloadSchemaRegistry, ILogger<ApiEventSchemaRegistration>)

Registers the gateway's own event payloads (All) in its payload schema registry when it starts, as every producer does (openspec api-gateway, Payload Schema Registry), so clients decode the state, trigger and topic catalog events through it. In the background: it never delays the gateway's start. The registry's store goes through the Dapr sidecar, which usually accepts connections only after the gateway has started, so a failed registration is retried every RetryDelay until all of them are registered.

public ApiEventSchemaRegistration(PayloadSchemaRegistry registry, ILogger<ApiEventSchemaRegistration> logger)

Parameters

registry PayloadSchemaRegistry
logger ILogger<ApiEventSchemaRegistration>

Properties

RetryDelay

Wait before retrying the registrations that failed (the sidecar not ready yet at startup, a restarted state store). Short, as the progress listener's resubscribe: until the schemas are registered, clients cannot decode the gateway's events.

public TimeSpan RetryDelay { get; init; }

Property Value

TimeSpan

Methods

ExecuteAsync(CancellationToken)

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.

protected override Task ExecuteAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

Task

A Task that represents the long running operations.

Remarks

See Worker Services in .NET for implementation guidelines.