KRequest

@ApiStatus.Experimental
interface KRequest<Req, Res> : Request<Req, Res>

Kotlin-idiomatic request for invoking Restate services from within a handler.

Example usage:

toService<CounterKt>()
.request { add(1) }
.options { idempotencyKey = "123" }
.call()

Parameters

Req

the request type

Res

the response type

Functions

Link copied to clipboard
@ApiStatus.Experimental
abstract suspend fun call(): CallDurableFuture<Res>

Call the target handler and return a CallDurableFuture for the result.

Link copied to clipboard
suspend fun <Req, Res> Request<Req, Res>.call(context: Context): CallDurableFuture<Res>

Shorthand for Context.call

Link copied to clipboard
Link copied to clipboard
abstract fun getIdempotencyKey(): String
Link copied to clipboard
abstract fun getRequest(): Req
Link copied to clipboard
abstract fun getRequestTypeTag(): TypeTag<Req>
Link copied to clipboard
abstract fun getResponseTypeTag(): TypeTag<Res>
Link copied to clipboard
abstract fun getTarget(): Target
Link copied to clipboard
@ApiStatus.Experimental
abstract fun options(block: InvocationOptions.Builder.() -> Unit): KRequest<Req, Res>

Configure invocation options using a DSL.

Link copied to clipboard
@ApiStatus.Experimental
abstract suspend fun send(delay: Duration? = null): InvocationHandle<Res>

Send the request without waiting for the response.

Link copied to clipboard
suspend fun <Req, Res> Request<Req, Res>.send(context: Context, delay: Duration? = null): InvocationHandle<Res>

Shorthand for Context.send

Link copied to clipboard
abstract fun toBuilder(): RequestBuilder<Req, Res>