toVirtualObject

Create a builder for invoking a Restate virtual object from within a handler.

Example usage:

@Handler
suspend fun myHandler(): Long {
val result = toVirtualObject<Counter>("my-counter")
.request { add(1) }
.call()
.await()
return result
}

Return

a builder for creating typed requests

Parameters

key

the key identifying the specific virtual object instance

Type Parameters

SVC

the virtual object class annotated with @VirtualObject