Table of Contents

Class LiveSessionResolver

Namespace
DatabentoDotNet.Extensions.Hosting
Assembly
DatabentoDotNet.Extensions.Hosting.dll

Turns a bound LiveSessionOptions into a ResolvedLiveSession, collecting every failure rather than stopping at the first.

public static class LiveSessionResolver
Inheritance
LiveSessionResolver
Inherited Members

Remarks

This is the only crossing, and both callers use it. LiveSessionValidator calls it at startup and the registration calls it when it builds a runner, so a configuration that validates is a configuration that resolves — because no second path exists to disagree. That is the rule DbnTime already enforces for the UndefTimestamp sentinel, applied to a different boundary for the same reason.

It never re-implements a check the library already makes. A key goes through new ApiKey(text) and a symbol list through Symbols.From; when either throws, the message is kept and the configuration path is prefixed to it. A resolver that decided for itself what a valid key looks like would be a second copy of that rule, and the copy that silently disagrees is the one nobody is looking at.

Every failure names its configuration path, because the person reading the message is looking at an appsettings.json, not at this assembly: Databento:Live:equities:Subscriptions:0:Schema — 'mbp1' is not a Databento schema.

That path is rooted at the section the host actually registered, never at the literal Databento. AddDatabento("MyApp:Feeds") is a supported registration, so a message rooted at the conventional name would point at a key that does not exist in the reader's file — which is worse than naming no path at all, because it sends them looking. The root therefore arrives as sectionPath, captured by the registration in the same statement that captures it for BindConfiguration: the message and the binding cannot disagree, because one value produces both.

What resolution checks, and what it does not. Everything this method can decide on its own is decided here, so that its failure names a path: the API key, the dataset, each subscription's schema, symbology and symbol set, every duration and instant, the reconnect pair — including the cross-field rule that InitialDelay cannot exceed MaxDelay — and the gateway endpoint, port range included. Three constraints the guide documents are not checked here, because the library already checks them and the paragraph above is why this does not check them a second time:

  • HeartbeatInterval's 5–1800 second range and ReadTimeout's positivity, both enforced by LiveClient's own init accessors.
  • UseSnapshot's two rules — the mbo schema only, and never together with Start — enforced by Subscription.Validate, which is internal to DatabentoDotNet.Live and so cannot be delegated to from here even if that were wanted.

So "validated at startup" means every value parsed and converted, not every documented constraint satisfied. Those three surface from StartSessionAsync(CancellationToken) instead — as an ArgumentOutOfRangeException or an ArgumentException naming the property rather than the configuration path. That is still a loud, immediate failure and not a background one: LiveSessionService.StartAsync awaits StartSessionAsync before base.StartAsync, so the host's boot fails either way. What is lost is only the path, and the alternative — a second copy of three rules that already exist, free to drift from them — is the trade this resolver refuses everywhere else too.

Fields

ApiKeyEnvironmentVariable

The environment variable consulted when no configuration supplies a key.

public const string ApiKeyEnvironmentVariable = "DATABENTO_API_KEY"

Field Value

string

Methods

PathFor(string, string)

The configuration path a named session binds from: {sectionPath}:Live:{name}.

public static string PathFor(string sectionPath, string name)

Parameters

sectionPath string

The section AddDatabento was given — DefaultSectionName for the conventional registration, something else for a host that named its own.

name string

The session's registration name.

Returns

string

Resolve(string, string, LiveSessionOptions, DatabentoOptions, string?)

Resolves one session, or reports why it cannot be resolved.

public static LiveSessionResolutionResult Resolve(string sectionPath, string name, LiveSessionOptions options, DatabentoOptions root, string? environmentApiKey)

Parameters

sectionPath string

The section AddDatabento was given, which every failure message is rooted at. See the remarks on LiveSessionResolver for why it is threaded in rather than assumed.

name string

The session's registration name.

options LiveSessionOptions

The bound options.

root DatabentoOptions

The root options, consulted for a key the session does not carry.

environmentApiKey string

The value of ApiKeyEnvironmentVariable, or null. A parameter rather than an ambient read, so that the precedence chain is something a test can state and this method mutates nothing.

Returns

LiveSessionResolutionResult

Remarks

sectionPath is first because of what the alternative costs. The parameters read in the order they compose the path — {sectionPath}:Live:{name} — which is a rule a reader can check against the call site at a glance. Appending it instead would put it next to environmentApiKey, and transposing those two would root every message at an API key and hand the key to ApiKey(string)'s validation as a path. This library's messages never contain the key, and an ordering that makes leaking it a plausible slip is not one to hold under SemVer. Next to name the same slip is merely a confusing path.