WowClient

The typed clients of the peers' HTTP routes, all on one JDK HttpClient and one EndpointResolver, in one ClientMode: commands sends command objects as the location-transparent CommandClient does in process, and queries reads their snapshots, events, datasets and states as the QueryApi does. A peer's commands and state classes are found in the contract its api jar carries, read from the class path: a consumer depends on the peer's *-api and writes no path.

Build it with builder, naming its mode: Builder.service or Builder.user. Close it when done: it closes the JDK client it built, not one it was given (Builder.httpClient).

WowClient.builder()
.endpoints(EndpointResolver.of(emptyMap(), mapOf("eshop-ordering" to URI.create("http://ordering:9090"))))
.service("basket-service")
.build()
.use { client ->
client.commands.of(caller).wait(CommandRequest.to(EshopOrderingContract.Order.ref(tenantId, id), body))
}

Types

Link copied to clipboard
class Builder

How a WowClient is built: its mode is named (service or user); every other setting has a default.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The command client, sending as an anonymous caller until CommandClient.of gives it another.

Link copied to clipboard

The query client of the peers' read routes, for a caller (QueryApi.of); see HttpQueryApi.

Functions

Link copied to clipboard
open override fun close()

Closes the JDK client this client built; one it was given stays its owner's to close.

Link copied to clipboard
suspend fun manifestOf(context: String, caller: Caller): Manifest

The Manifest of context, a peer described by its Manifest alone (Builder.manifestPeers), read from its GET /wow/manifest as caller and kept a minute, as the NamedCommands to it are checked against: what a console or a gateway offers of its commands.