waitFor

suspend fun waitFor(id0: ID0, id1: ID1, data: VS, timeout: <Error class: unknown class>? = null): VR

Waits for a response associated with the given id0 and id1.

This call establishes a one-time request/response exchange:

  • When subscribed, the provided data is published into the send table.

  • The function then suspends until a matching response is delivered via notify for the same (id0, id1).

  • If a timeout is specified, the suspension will be cancelled after the given duration, and a QuatiException.GatewayTimeout is thrown.

Exclusivity

Only one active waiter is allowed per (id0, id1) pair. If another waiter already exists, this function fails immediately with QuatiException.InternalServerError.

After either a response or timeout, both the request and response entries are automatically removed from the exchange table.

Return

the response payload sent via notify

Parameters

id0

the outer identifier

id1

the inner identifier

data

the request payload to send

timeout

optional maximum time to wait for a response

Throws

if a waiter already exists

if no response is received in time