Interface IBowireMockEmitter
- Namespace
- Kuestenlogik.Bowire.Mocking
- Assembly
- Kuestenlogik.Bowire.dll
Extension point for protocol plugins that need to contribute broadcast-style replay behaviour to the mock server — protocols whose wire model is "server pushes on its own schedule" rather than "client makes a request". MQTT and DIS are the reference implementations (the MQTT emitter is built into the mock server; DIS lives in its own plugin).
public interface IBowireMockEmitter : IAsyncDisposable
- Inherited Members
Remarks
Lifecycle:
- Host builds a mock-server configuration with the plugin-provided emitters attached.
- After HTTP startup, the mock server calls CanEmit(BowireRecording) on each emitter; the ones that claim the recording get StartAsync(BowireRecording, MockEmitterOptions, ILogger, CancellationToken) invoked.
- On mock-server shutdown each started emitter is disposed via IAsyncDisposable.
Emitters run for the entire lifetime of the mock server; they
typically own their own network listeners (UDP multicast socket,
MQTT broker, ...) so the mock host doesn't need to learn every
protocol's transport. Dispatch goes through the plugin — the
mock package takes no compile-time dependency on any emitter's
protocol stack. Symmetrically, the plugin takes no compile-time
dependency on the mock server: this interface is declared in the
core Kuestenlogik.Bowire contract package.
Properties
Id
Short identifier for logging and diagnostics (e.g. "dis",
"dds"). Typically matches the protocol plugin's
IBowireProtocol.Id so logs correlate cleanly.
string Id { get; }
Property Value
Methods
CanEmit(BowireRecording)
Decide whether this emitter should run for the given recording.
Return true when at least one step in the recording
targets this emitter's protocol; the mock server skips emitters
whose recording has no relevant steps so empty UDP sockets
don't get bound for nothing.
bool CanEmit(BowireRecording recording)
Parameters
recordingBowireRecording
Returns
StartAsync(BowireRecording, MockEmitterOptions, ILogger, CancellationToken)
Start the emitter. Called once per mock-server run, after Kestrel has bound its HTTP listener and any built-in emitters have started. The emitter owns its transport and schedule; this call should return once the transport is ready to send (not when the emission is complete).
Task StartAsync(BowireRecording recording, MockEmitterOptions options, ILogger logger, CancellationToken ct)
Parameters
recordingBowireRecordingoptionsMockEmitterOptionsloggerILoggerctCancellationToken