Class HttpCatalogueProvider

Namespace
Kuestenlogik.Bowire.Sources
Assembly
Kuestenlogik.Bowire.dll

Fetches a BowireCatalogueDocument from a configured URL (#136 Phase B). Bound to Bowire:Discovery:Catalogue:Http via BowireHttpCatalogueOptions.

public sealed class HttpCatalogueProvider : IBowireCatalogueProvider
Inheritance
HttpCatalogueProvider
Implements
Inherited Members

Remarks

The provider expects the URL to return the document shape documented on BowireCatalogueDocument:

{ "version": 1, "entries": [ { "url": "https://..." }, ... ] }

A missing / empty URL resolves to an empty list (no throw) so a half-configured host doesn't crash at startup. Non-2xx responses, network errors, and malformed JSON propagate as exceptions — the catalogue endpoint surfaces them as problem-details so the operator can spot the misconfiguration.

The provider takes an explicit options snapshot at fetch time, re-resolved on every refresh, so config edits land without a restart. Same pattern the Bowire OAuth proxy uses.

Constructors

HttpCatalogueProvider()

Parameterless ctor for the assembly-scan discovery path. Uses environment-variable-driven defaults so the registry can instantiate the provider before AddBowireCatalogue has wired explicit options.

public HttpCatalogueProvider()

Properties

Id

Stable id used to select this provider in config (e.g. "local", "http", "consul", "kubernetes", "agent"). Compared case-insensitively against the configured provider key.

public string Id { get; }

Property Value

string

Name

Human-readable provider name for the Settings → Sources tab and startup logs (e.g. "Local file", "HTTP endpoint", "Consul").

public string Name { get; }

Property Value

string

Methods

FetchAsync(CancellationToken)

Fetch the current catalogue snapshot. Called on a configurable refresh interval (default 5 minutes; see RefreshInterval) and on a manual trigger from the workbench UI.

public Task<IReadOnlyList<BowireCatalogueEntry>> FetchAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Cancellation token — refresh cycles are bounded by the configured interval, so providers should respect it to avoid piling up overlapping fetches when an upstream is slow.

Returns

Task<IReadOnlyList<BowireCatalogueEntry>>

The list of catalogue entries currently visible to this provider. Empty list is fine (means "no entries"); throw to signal a hard fetch failure — the registry catches and surfaces it as a problem-details response on GET /api/catalogue/entries.