Skip to content

FluxbaseRpc

//fluxbase-kotlin/io.github.nimbleflux.fluxbase.rpc/FluxbaseRpc

[jvm]
class FluxbaseRpc(http: FluxbaseHttpClient)

RPC (Remote Procedure Call) module — port of FluxbaseRPC from sdk/src/rpc.ts.

Invokes Fluxbase’s namespaced SQL procedures via POST /api/v1/rpc/{namespace}/{name}. Procedures are namespaced (default namespace is "default"; Wayli uses "wayli").

Usage:

// Synchronous invoke
val (data, error) = client.rpc.invoke("get-trip-summary", mapOf("trip_id" to "abc"), RpcInvokeOptions(namespace = "wayli"))
// Async invoke + poll
val (started, _) = client.rpc.invoke("long-report", async = true)
val (final, _) = client.rpc.waitForCompletion(started!!.executionId!!)
FluxbaseRpc [jvm]
constructor(http: FluxbaseHttpClient)
Name Summary
getLogs [jvm]
suspend fun getLogs(executionId: String, afterLine: Int? = null): FluxbaseResponse<List<RpcExecutionLog>>
Get execution logs. GETs /api/v1/rpc/executions/{id}/logs. Port of getLogs() in rpc.ts:177.
getStatus [jvm]
suspend fun getStatus(executionId: String): FluxbaseResponse<RpcExecution>
Get the status of an async RPC execution. GETs /api/v1/rpc/executions/{id}. Port of getStatus() in rpc.ts:148.
invoke [jvm]
suspend fun invoke(name: String, params: Map<String, Any?>? = null, options: RpcInvokeOptions = RpcInvokeOptions()): FluxbaseResponse<RpcInvokeResponse>
Invoke an RPC procedure. POSTs /api/v1/rpc/{namespace}/{name}. Port of invoke() in rpc.ts:111.
list [jvm]
suspend fun list(namespace: String? = null): FluxbaseResponse<List<RpcProcedureSummary>>
List available RPC procedures. GETs /api/v1/rpc/procedures. Port of list() in rpc.ts:69.
waitForCompletion [jvm]
suspend fun waitForCompletion(executionId: String, options: WaitForCompletionOptions = WaitForCompletionOptions()): FluxbaseResponse<RpcExecution>
Poll for execution completion with exponential backoff. Port of waitForCompletion() in rpc.ts:212.