Interface IAsyncApiBindingResolver

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

Per-wire binding resolver. One implementation per AsyncAPI binding spec (mqtt, kafka, ws, amqp, …) — translates the binding-specific fields (topic, qos, retain, partition-key, subprotocol, …) and the AsyncAPI channel/operation pair into the corresponding wire-plugin call.

Resolvers are lookups from IBowireProtocol.Id, so the AsyncAPI loader can:

  1. Parse the channel's bindings: block,
  2. Pick the resolver whose BindingId matches the binding key,
  3. Ask the resolver to materialise an invocation against the corresponding wire plugin (looked up through BowireProtocolRegistry).

Phase A only ships the MQTT resolver. Phase B adds Kafka + WebSocket. Phase C the remaining bindings whose wire plugins also need to land.

public interface IAsyncApiBindingResolver

Properties

BindingId

AsyncAPI binding key — "mqtt", "kafka", "ws", "amqp", "nats", … — as it appears under operations.<name>.bindings.<key> in the document. Matches Id by convention so the resolver and the wire plugin pair up by id.

string BindingId { get; }

Property Value

string

Methods

BuildMethod(AsyncApiChannelContext)

Build a BowireMethodInfo from an AsyncAPI operation + channel + the parsed binding block. The returned method is wired onto the service that represents the channel; invocations on that method run through InvokeAsync(AsyncApiChannelContext, List<string>, Dictionary<string, string>?, CancellationToken) below.

BowireMethodInfo BuildMethod(AsyncApiChannelContext channel)

Parameters

channel AsyncApiChannelContext

Returns

BowireMethodInfo

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

Dispatch a discovered AsyncAPI method to its wire plugin. Implementation looks up the wire plugin via BowireProtocolRegistry, maps the AsyncAPI channel + binding fields onto the wire plugin's invocation contract (e.g. MQTT publish topic + qos), and forwards the JSON payloads.

Task<InvokeResult> InvokeAsync(AsyncApiChannelContext channel, List<string> jsonMessages, Dictionary<string, string>? metadata, CancellationToken ct)

Parameters

channel AsyncApiChannelContext
jsonMessages List<string>
metadata Dictionary<string, string>
ct CancellationToken

Returns

Task<InvokeResult>