HttpQueryApi

The QueryApi of the peers' HTTP read routes: the same queries as in process, sent as JSON ({"kind": "list", ...}) to the query route of each model, POST /{context}/{aggregate}/{model}/query, the dataset route POST /wow/dataset/{context}/{dataset}/query, and the state read GET /{context}/{aggregate}/{id}/state, on the port transport's mode calls, as the caller of gives:

  • in service mode, on the peer's internal read routes, the caller asserted as the root context of Wow-Call: the peer scopes the read to its tenant, owner and space and lets its policies see its subject and application;

  • in user mode, on the public routes with the end user's forwarded credential.

A peer's rows are typed by the caller: Queries.snapshots of a state class decodes the state as that class, found by its schema in the peer's contract (models); Queries.snapshots of a type decodes a state as an ObjectNode, which the generated field constants of the peer's api read; Queries.events decodes an event body as the class the contract names for it, when the class path has it (the peer's api jar), else as an ObjectNode, as in process; a dataset's rows and ModelQueries.dynamic rows as the class given.

A streamed list (RowQueries.stream) reads the peer's server-sent events and resumes on its own: when the peer ends it resumably (its hold expired, it is stopping, its store reclaimed the permit), sends a problem a retry may get past, or the connection drops, it is asked again with Last-Event-ID, the last row's position, for what is left of its limit (the peer reads up to the limit again after the position), so it never answers more rows than the limit. It waits between resumes as the transport's RetryPolicy says (at once after a hold expired, else the peer's Retry-After or the backoff), and fails after the policy's attempts in a row without a row read.

A query is sent again when its problem says a retry may get past it (its retry member); any other problem, and one the retries do not get past, is a me.ahoo.wow.api.problem.WowProblemException, as is a failure of the transport (wow.peer.unavailable, wow.query.timeout). A single row or a state that is not found, or that the caller may not see, is null. There are no trusted queries over HTTP: a peer reads for a caller (of); trusted code reads its own node (me.ahoo.wow.api.read.NodeQueryApi).

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun of(caller: Caller): Queries