Class BowireAsyncApiProtocol

Namespace
Kuestenlogik.Bowire.AsyncApi
Assembly
Kuestenlogik.Bowire.AsyncApi.dll

AsyncAPI as a Bowire discovery source. Implements IBowireProtocol so it slots into the existing assembly-scanned registry, URL-hint routing (asyncapi@./doc.yaml), and recording/mock plumbing — but it does not own a wire. DiscoverAsync(string, bool, CancellationToken) parses an AsyncAPI document and turns its channels into BowireServiceInfo nodes; the actual publish/subscribe calls in InvokeAsync(string, string, string, List<string>, bool, Dictionary<string, string>?, CancellationToken) are routed to the matching wire plugin (MQTT, Kafka, WebSocket, …) at runtime via BowireProtocolRegistry.

DiscoverAsync(string, bool, CancellationToken) reads an AsyncAPI 3.0 (or 2.x) document, walks its channels, and emits one BowireServiceInfo per channel. InvokeAsync(string, string, string, List<string>, bool, Dictionary<string, string>?, CancellationToken) (a send operation) and InvokeStreamAsync(string, string, string, List<string>, bool, Dictionary<string, string>?, CancellationToken) (a receive) resolve the document, operation, server and binding fields the same way and hand them to the binding resolver for the server's protocol, which forwards to the wire plugin. Nothing on either path throws at an operator (#357): what is missing — the document, the operation, a resolver, a plugin, a subscribe shape for the binding — comes back as an error result or an error frame that names it.

public sealed class BowireAsyncApiProtocol : IBowireProtocol, IBowireProxySupport
Inheritance
BowireAsyncApiProtocol
Implements
Inherited Members

Constructors

BowireAsyncApiProtocol()

public BowireAsyncApiProtocol()

Properties

Description

One-line description shown next to the plugin's display name in Settings → Plugins. Optional; defaults to empty so the row falls back to "DisplayName + version" without the description line. Keep it short (≤ 100 characters) — the row truncates anything wider than the manage panel.

public string Description { get; }

Property Value

string

IconSvg

SVG icon for the protocol tab.

public string IconSvg { get; }

Property Value

string

Id

Short identifier (e.g., "grpc", "signalr").

public string Id { get; }

Property Value

string

Name

Protocol name shown in UI tabs.

public string Name { get; }

Property Value

string

ProxyNote

One sentence on what goes direct and why, for Partial and None.

public string? ProxyNote { get; }

Property Value

string

ProxyNoteKey

The catalogue key for ProxyNote (#691): the workbench shows the translation and falls back to the English note.

public string? ProxyNoteKey { get; }

Property Value

string

ProxySupport

How far this plugin's connections follow the proxy.

public BowireProxySupport ProxySupport { get; }

Property Value

BowireProxySupport

Methods

DiscoverAsync(string, bool, CancellationToken)

Discover available services and methods.

public Task<List<BowireServiceInfo>> DiscoverAsync(string serverUrl, bool showInternalServices, CancellationToken ct = default)

Parameters

serverUrl string
showInternalServices bool
ct CancellationToken

Returns

Task<List<BowireServiceInfo>>

Initialize(IServiceProvider?)

Hook the AsyncAPI protocol into the host's BowireProtocolRegistry. We need the registry to dispatch invocations to wire plugins (MQTT, Kafka, …); without it the plugin still loads documents and renders services, but InvokeAsync(string, string, string, List<string>, bool, Dictionary<string, string>?, CancellationToken) can't route anywhere.

Called by MapBowire() and WithMcpAdapter() on every IBowireProtocol after discovery scans pick it up. Standalone CLI passes its own ServiceProvider too.

public void Initialize(IServiceProvider? serviceProvider)

Parameters

serviceProvider IServiceProvider

InvokeAsync(string, string, string, List<string>, bool, Dictionary<string, string>?, CancellationToken)

Invoke a unary or client-streaming call.

public Task<InvokeResult> InvokeAsync(string serverUrl, string service, string method, List<string> jsonMessages, bool showInternalServices, Dictionary<string, string>? metadata = null, CancellationToken ct = default)

Parameters

serverUrl string
service string
method string
jsonMessages List<string>
showInternalServices bool
metadata Dictionary<string, string>
ct CancellationToken

Returns

Task<InvokeResult>

InvokeStreamAsync(string, string, string, List<string>, bool, Dictionary<string, string>?, CancellationToken)

A receive operation: the same resolution as InvokeAsync(string, string, string, List<string>, bool, Dictionary<string, string>?, CancellationToken), handed to the resolver's stream path. #357 — nothing here throws at an operator: a document that was not discovered, an unknown operation, a server without a resolver, or a binding that cannot subscribe yet all arrive as one {"error": …} frame in the stream pane.

public IAsyncEnumerable<string> InvokeStreamAsync(string serverUrl, string service, string method, List<string> jsonMessages, bool showInternalServices, Dictionary<string, string>? metadata = null, CancellationToken ct = default)

Parameters

serverUrl string
service string
method string
jsonMessages List<string>
showInternalServices bool
metadata Dictionary<string, string>
ct CancellationToken

Returns

IAsyncEnumerable<string>

OpenChannelAsync(string, string, string, bool, Dictionary<string, string>?, CancellationToken)

Open an interactive channel (for duplex/client-streaming).

public Task<IBowireChannel?> OpenChannelAsync(string serverUrl, string service, string method, bool showInternalServices, Dictionary<string, string>? metadata = null, CancellationToken ct = default)

Parameters

serverUrl string
service string
method string
showInternalServices bool
metadata Dictionary<string, string>
ct CancellationToken

Returns

Task<IBowireChannel>