virtualObject

@ApiStatus.Experimental
open fun <SVC> virtualObject(clazz: Class<SVC>, key: String): SVC

EXPERIMENTAL API: Simple API to invoke a Restate Virtual Object from the ingress.

Create a proxy client that allows calling virtual object methods directly and synchronously, returning just the output (not wrapped in Response). This is the recommended approach for straightforward request-response interactions.


Client client = Client.connect("http://localhost:8080");

var counterProxy = client.virtualObject(Counter.class, "my-counter");
int count = counterProxy.increment();

For advanced use cases requiring asynchronous request handling, access to Response metadata, or invocation options (such as idempotency keys), use virtualObjectHandle instead.

Return

a proxy client to invoke the virtual object

Parameters

clazz

the virtual object class annotated with VirtualObject

key

the key identifying the specific virtual object instance