Surgewave

The Surgewave plugin browses topics and produces / consumes messages against a Küstenlogik Surgewave broker. Surgewave's broker speaks both the native Surgewave wire and the Kafka wire — the plugin lets you pick which protocol it uses against the same broker, including Confluent Schema Registry decode in Kafka mode.

Package: Kuestenlogik.Bowire.Protocol.Surgewave (sibling repo, not bundled with the CLI)

Setup

bowire plugin install Kuestenlogik.Bowire.Protocol.Surgewave

Then point Bowire at a surgewave:// URL.

Standalone

bowire --url surgewave://broker.example:9092

Embedded

app.MapBowire(options =>
{
    options.ServerUrls.Add("surgewave://broker.example:9092");
});

In-process testing has a surgewave://embedded URL that taps the host's broker without going through the network.

URL shapes

surgewave://broker.example:9092                                            # single broker, auto-detect protocol
surgewave://b1:9092,b2:9092                                                # bootstrap servers CSV
broker.example:9094                                                    # bare host:port also accepted
surgewave://broker:9092?protocol=surgewave                                     # force the native Surgewave wire
surgewave://broker:9092?protocol=kafka                                     # force the Kafka-compatible wire
surgewave://broker:9092?protocol=kafka&schema-registry=http://sr:8081      # Kafka-mode + Confluent Schema Registry
surgewave://embedded                                                       # in-process broker tap

Protocol modes

The ?protocol= query parameter picks how SurgewaveClientBuilder configures the wire:

Value Effect
surgewave / native / surgewave-native UseSurgewaveProtocol() — max performance, advanced features (SharedMemory transport, batching presets, handler dispatch)
kafka UseKafkaProtocol() — interoperable wire, Confluent Schema Registry support
auto (default when omitted) UseAutoDetect() — try native first, fall back to Kafka

Unknown values fall back to auto, so a typo never breaks discovery.

Discovery

Connects via SurgewaveClient.Create(...).BuildAsync() and surfaces a Cluster service with broker metadata. Topic enumeration on the native Surgewave protocol is pending an admin/metadata API on the client SDK — once that lands, topics populate the sidebar the same way the Kafka plugin already does via IAdminClient.GetMetadata. With ?schema-registry= on the URL, discovery also lists the topics the registry holds a schema for (see Typed produce). Any other topic is entered by hand.

Entering a call by hand

The plugin describes its hand-entry form (IBowireManualEntry), so Compose renders a form for it and the freeform form offers only its method types:

Call kind Method type service / method
produce Unary {topic} / produce
consume ServerStreaming {topic} / consume

The fields are topic (required, feeds the templates), and key and partition (produce only, sent as the call's metadata, where produce reads them).

Settings

Both live under Settings → Surgewave in the workbench and take effect on the next call.

Setting Default What it does
discoveryTimeoutSeconds 5 Bounds the discovery probe. A broker that neither answers nor refuses would otherwise hold the sidebar open until the caller gave up.
clientIdPrefix bowire Prefix for the client id this plugin presents; a short random suffix is appended so two workbench tabs against one broker don't collide.

Methods

Per topic, identical shape to Bowire.Protocol.Kafka:

Method Kind Description
consume ServerStreaming Subscribe + yield one JSON envelope per message (topic, partition, offset, timestamp, key/keyBase64, value/valueBase64, bytes)
produce Unary Publish one message; optional key and partition via metadata, every other metadata key as a record header

The envelope shape matches Bowire.Protocol.Kafka byte-for-byte, so a recording captured against one plugin replays against the other — swap the step's protocol string from "kafka" to "surgewave" (or vice versa).

A consumed record's headers arrive in the envelope as headers: [{ "key", "value", "valueBase64" }], value being the UTF-8 text or null, valueBase64 the bytes; null when the record has none. Bowire's own markers (keys starting with __bowire) are never sent as headers.

Schema Registry (Kafka mode)

When the URL carries ?schema-registry=… and the consumed message is framed in the Confluent wire format (0x00 magic byte + 4-byte big-endian schema id + Avro/JSON body), the plugin decodes it on the fly. The envelope's value field then carries the JSON projection and an additional encoding field tags the schema kind ("avro" or "json"). Schemaless topics, plain UTF-8, and opaque binary keep the original fallback path.

Typed produce (#85)

With ?schema-registry= on the URL, produce looks up the topic's subjects (<topic>-value, <topic>-key) and, when the subject has a schema, encodes the record in the registry's wire format: 0x00, the 4-byte big-endian schema id, then the body.

Subject's schema Body Value entered as
Avro Avro binary The JSON consume shows: records as objects, enums as their symbol, bytes and fixed as base64, a union as the plain value of a branch (Avro's {"string": "x"} works too), logical types as their base value or their text
JSON Schema The JSON document JSON; it is not yet checked against the schema's rules (#98)
Protobuf — Refused, nothing is produced (#97)
none UTF-8, as before Any text

The key, from the metadata key key, is encoded with the key subject's schema the same way; for a string schema the key is the text itself. A value that does not fit the schema is refused with the path that failed ($.quantity: expected a 32-bit integer.), and a registry that does not answer refuses the produce rather than sending untyped bytes to a typed topic. The produce result reports encoding (avro, json, utf-8) and schemaId.

Consume decodes the key as well as the value; encoding and keyEncoding name the schema kind each was decoded with. Whatever consume shows produces the same record again.

Discovery lists one service per topic the registry holds a subject for, and describes the produce input from the value schema: an Avro record's or a JSON Schema object's fields, with their types, enums, nesting, and which are required.

The wire-format decoder is duplicated from Bowire.Protocol.Kafka (same KafkaSchemaRegistry + AvroValueToJson types). Two consumers don't justify a third NuGet package — if a third Kafka-wire plugin shows up, the natural refactor is to lift them into a shared library.

Security

Surgewave reuses the same auth markers as the Kafka plugin — see Authentication:

  • __bowireMtls__ for client-cert + CA bundle (PEM strings, no temp files)
  • __bowireKafkaSasl__ for SASL/PLAIN, SCRAM-SHA-256/512, OAUTHBEARER

Both markers are stripped from the metadata dict before it's forwarded as message headers, so secrets never reach the wire.

Mock replay

SurgewaveMockEmitter plugs into Bowire's mock server via IBowireMockEmitter. Recordings tagged protocol: "surgewave" get re-published at the original cadence:

Metadata key (first step) Purpose Default
bootstrap (or bootstrap-servers) Broker CSV localhost:9092
Per-step key / partition Same knobs as the live produce path —

Payload source: responseBinary (base64) wins so binary payloads round-trip byte-for-byte; text-only recordings fall back to UTF-8 of body.

Relationship to the Kafka plugin

Both ship side by side and register under their own protocol id (surgewave vs kafka). Run them together when a single environment hits both Surgewave and Kafka brokers; recordings stay portable between the two because the consume / produce envelopes are identical.

See also: Kafka, Authentication, Recording.