Interface IBowireMockHostingExtension

Namespace
Kuestenlogik.Bowire.Mocking
Assembly
Kuestenlogik.Bowire.dll

Plugin-contributed hosting extension for the Bowire mock server. Lets a protocol plugin participate in the Kestrel pipeline setup (force HTTP/2, register DI services, map endpoints) based on the loaded recording — without baking protocol-specific knowledge into Kuestenlogik.Bowire.Mock.

public interface IBowireMockHostingExtension

Remarks

The canonical use case is gRPC server-reflection: when the recording contains gRPC steps with attached schemaDescriptors, the mock host must add gRPC services, register a ReflectionServiceImpl built from the captured FileDescriptorSets, and map a gRPC endpoint so a peer Bowire workbench can auto-discover the mocked methods. All of that lives on the Protocol.Grpc plugin since the plugin-isation refactor; Kuestenlogik.Bowire.Mock just iterates the registered extensions and calls the lifecycle hooks at the right moment.

Discovered via PluginManager.EnumeratePluginServices<IBowireMockHostingExtension>() at MockServer startup. Default-implemented members let a plugin opt into only the hooks it needs.

Properties

Id

Stable id, lower-case, matching the protocol the extension belongs to (e.g. "grpc"). Surfaced in logs only — the host never dispatches by id, it always asks each extension in turn.

string Id { get; }

Property Value

string

Methods

ConfigureServices(IServiceCollection, BowireRecording, ILoggerFactory)

Register DI services the protocol-specific mock surface needs. Called during MockServer service-collection setup, before the host builds the application. gRPC uses this to add AddGrpc() + a per-recording ReflectionServiceImpl.

void ConfigureServices(IServiceCollection services, BowireRecording recording, ILoggerFactory loggerFactory)

Parameters

services IServiceCollection
recording BowireRecording
loggerFactory ILoggerFactory

MapEndpoints(IEndpointRouteBuilder, BowireRecording)

Map protocol-specific endpoints. Called inside the mock host's UseEndpoints block, after the recording-replay middleware is mounted. gRPC uses this to map the reflection service so peer workbenches can auto-discover.

void MapEndpoints(IEndpointRouteBuilder endpoints, BowireRecording recording)

Parameters

endpoints IEndpointRouteBuilder
recording BowireRecording

RequiresHttp2(BowireRecording)

Return true when at least one step in the recording needs HTTP/2 hosting. The mock server picks the highest-required protocol level across all extensions before configuring Kestrel. gRPC says yes when the recording contains gRPC steps; REST/SignalR/SSE say no.

bool RequiresHttp2(BowireRecording recording)

Parameters

recording BowireRecording

Returns

bool