Class MockServerOptions

Namespace
Kuestenlogik.Bowire.Mock
Assembly
Kuestenlogik.Bowire.Mock.dll

Tunables for the standalone MockServer used by the bowire mock CLI subcommand.

public sealed class MockServerOptions
Inheritance
MockServerOptions
Inherited Members

Constructors

MockServerOptions()

public MockServerOptions()

Properties

CaptureMissPath

When set, unmatched REST requests are appended as placeholder steps to the named file (Phase 3c). CLI: --capture-miss <path>.

public string? CaptureMissPath { get; init; }

Property Value

string

CertPassword

Password for a PKCS#12 CertPath. Null for none / PEM.

public string? CertPassword { get; init; }

Property Value

string

CertPath

Path to an operator-supplied certificate for the HTTPS listener — a .pfx/.p12 (PKCS#12, with CertPassword) or a PEM file. Null = generate a self-signed dev certificate.

public string? CertPath { get; init; }

Property Value

string

Chaos

Chaos-injection tunables forwarded to the embedded middleware (Phase 3a). Populated from the --chaos CLI flag via Parse(string) or set programmatically. Defaults are off.

public ChaosOptions Chaos { get; init; }

Property Value

ChaosOptions

ControlToken

Shared secret that unlocks the runtime scenario-switch control endpoint (POST /__bowire/mock/scenario). When null (default) the control surface is 404ed. CLI: --control-token <value>.

public string? ControlToken { get; init; }

Property Value

string

Emitters

Extension point for plugin-contributed broadcast emitters (DIS, DDS, raw-UDP multicast, ...). The mock server iterates this list after HTTP startup, calls CanEmit(BowireRecording) per candidate, and starts the ones that claim the recording. Emitters are disposed when the mock shuts down. Default is empty — protocols that live inside Kuestenlogik.Bowire.Mock (MQTT) wire up through dedicated paths rather than this list so legacy behaviour stays unchanged.

public IReadOnlyList<IBowireMockEmitter> Emitters { get; init; }

Property Value

IReadOnlyList<IBowireMockEmitter>

Faults

Per-method fault-injection rules (#170) forwarded to the embedded middleware. Populated from the --faults mock-faults.json CLI flag via LoadJson(string, bool) or set programmatically. Defaults to an empty set (off).

public FaultRuleSet Faults { get; init; }

Property Value

FaultRuleSet

GraphQlSchemaPath

Path to a GraphQL SDL file. When set, the mock answers every POST /graphql request by parsing the incoming query, walking the schema for each selection-set field, and returning a sample-valued JSON response shaped to match. Unlike the other schema-only modes the response is synthesised per request (not pre-generated) because GraphQL responses are selection-set- dependent. Mutex with RecordingPath, SchemaPath, and GrpcSchemaPath.

public string? GraphQlSchemaPath { get; init; }

Property Value

string

GrpcSchemaPath

Path to a protobuf FileDescriptorSet binary (the output of protoc --descriptor_set_out=... --include_imports). When set, the mock synthesises a recording where every gRPC method gets a sample response encoded on the fly via ProtobufSampleEncoder. Same mutual- exclusion rules as SchemaPath: exactly one of RecordingPath, SchemaPath, GrpcSchemaPath, or GraphQlSchemaPath must be set.

public string? GrpcSchemaPath { get; init; }

Property Value

string

Host

Bind address — defaults to 127.0.0.1 so the mock is reachable only from the local machine. Set to 0.0.0.0 to expose on the LAN (e.g. for sidecar-container setups).

public string Host { get; init; }

Property Value

string

HostingExtensions

Plugin-contributed hosting extensions — services + endpoints + HTTP-2-requirement based on the loaded recording. gRPC plugin uses this to add AddGrpc() + ReflectionServiceImpl and to map the gRPC reflection endpoint when the recording has gRPC steps with attached descriptors.

public IReadOnlyList<IBowireMockHostingExtension> HostingExtensions { get; init; }

Property Value

IReadOnlyList<IBowireMockHostingExtension>

Https

#410: serve the mock over HTTPS instead of plaintext. Uses a supplied certificate (CertPath) or, when none is given, a fresh in-memory self-signed localhost certificate (untrusted by design).

public bool Https { get; init; }

Property Value

bool

HttpsPort

Optional port for the HTTPS listener. When null, HTTPS binds on Port. Only consulted when Https is true.

public int? HttpsPort { get; init; }

Property Value

int?

LiveSchemaHandlers

Plugin-contributed live-schema handlers — middleware-style request handlers that some schema kinds (GraphQL today) need because their responses are dispatch-time-dependent. The mock server registers the handler whose Kind matches the configured schema kind in front of the recording-replay middleware.

public IReadOnlyList<IBowireMockLiveSchemaHandler> LiveSchemaHandlers { get; init; }

Property Value

IReadOnlyList<IBowireMockLiveSchemaHandler>

LoggerFactory

Optional logger factory. When null, the server uses a default console factory.

public ILoggerFactory? LoggerFactory { get; init; }

Property Value

ILoggerFactory

Loop

When true, the MQTT proactive emitter replays the recording on repeat while the mock is up — the schedule loops back to step 0 after emitting the last publish. Useful for long-running demos with a static sensor stream. Default stays one-shot (emitter stops after the last step) so integration tests don't observe phantom repeats. CLI: --loop.

public bool Loop { get; init; }

Property Value

bool

Matcher

Matcher for the middleware. Defaults to ExactMatcher.

public IMockMatcher Matcher { get; init; }

Property Value

IMockMatcher

Port

TCP port to listen on.

public int Port { get; init; }

Property Value

int

ProxyBaseUrl

#407: forward unmatched requests to this real upstream base URL (partial mocking). Fixed by config, never taken from the request. Null = no proxy.

public string? ProxyBaseUrl { get; init; }

Property Value

string

ProxyRecordPath

#430: append each proxied response to this recording file (record-through). Null = don't persist.

public string? ProxyRecordPath { get; init; }

Property Value

string

RecordingPath

Path to the recording JSON file. Required unless SchemaPath is set (schema-only mock, Phase 3d). Exactly one of RecordingPath and SchemaPath must be supplied; StartAsync(MockServerOptions, CancellationToken) validates this.

public string? RecordingPath { get; init; }

Property Value

string

ReplaySpeed

Speed multiplier for streaming replay (Phase 2c onwards). Forwarded to ReplaySpeed on the embedded middleware. 1.0 preserves the recorded cadence; 0 emits every frame immediately; 2.0 is twice as fast.

public double ReplaySpeed { get; init; }

Property Value

double

RequestObserver

Optional sink that receives one entry per inbound request once the response has been written (#57). Forwarded into the inner RequestObserver. The workbench's MockRegistry wires a bounded MockRequestLog per running mock so the Mocks panel can render a live trace; CLI usage leaves it null and the observer call becomes a no-op branch.

public IMockRequestObserver? RequestObserver { get; init; }

Property Value

IMockRequestObserver

SchemaPath

Path to an OpenAPI 3 document (JSON or YAML). When set, the mock generates plausible responses directly from the schema without any recorded traffic (Phase 3d). Exclusive with RecordingPath.

public string? SchemaPath { get; init; }

Property Value

string

SchemaSources

Plugin-contributed schema-to-recording converters for the --schema / --grpc-schema / --graphql-schema modes. The mock server picks the entry whose Kind matches the configured schema kind ("openapi" / "protobuf" / "graphql") and delegates the load.

public IReadOnlyList<IBowireMockSchemaSource> SchemaSources { get; init; }

Property Value

IReadOnlyList<IBowireMockSchemaSource>

Select

Disambiguator when RecordingPath points at a file with multiple recordings. Either a recording name or id.

public string? Select { get; init; }

Property Value

string

Stateful

When true, the mock steps through the recording in strict order (Phase 3b). CLI: --stateful. Defaults to false.

public bool Stateful { get; init; }

Property Value

bool

StatefulWrapAround

When Stateful is on, wrap back to step 0 after the last step (default) or return a miss for every subsequent request when false. CLI: --stateful-once sets this to false.

public bool StatefulWrapAround { get; init; }

Property Value

bool

TransportHosts

Plugin-contributed transport hosts (MQTT broker, AMQP broker, DDS participant, ...). The mock server iterates this list at startup, calls ShouldStart(BowireRecording) per candidate, and starts the ones that claim the recording. Hosts are stopped when the mock shuts down.

Discovered alongside Emitters via the standard plugin-load pass. Empty by default — populate from a plugin directory in your wiring code (the bowire CLI does this automatically). Replaced the dedicated EnableMqtt / MqttPort properties when MQTT moved out of Kuestenlogik.Bowire.Mock into the Kuestenlogik.Bowire.Protocol.Mqtt plugin.

public IReadOnlyList<IBowireMockTransportHost> TransportHosts { get; init; }

Property Value

IReadOnlyList<IBowireMockTransportHost>

TransportPorts

Per-transport bind ports keyed by Id (e.g. "mqtt"1883). The mock server passes the configured port into the matching transport host's StartAsync(BowireRecording, MockTransportContext, CancellationToken) via RequestedPort. Missing keys default to 0 (OS-assigned). Hosts whose id isn't present here also get 0.

public IReadOnlyDictionary<string, int> TransportPorts { get; init; }

Property Value

IReadOnlyDictionary<string, int>

Watch

Watch the recording file for changes. Defaults to true.

public bool Watch { get; init; }

Property Value

bool