serviceHandle

@ApiStatus.Experimental
open fun <SVC> serviceHandle(clazz: Class<SVC>): ClientServiceHandle<SVC>

EXPERIMENTAL API: Advanced API to invoke a Restate service from the ingress with full control.

Create a handle that provides advanced invocation capabilities including:

  • Async request handling with CompletableFuture
  • Invocation options such as idempotency keys
  • Fire-and-forget requests via send()
  • Access to full Response metadata

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

// Use call() with method reference and wait for the result
Response<GreetingResponse> response = client.serviceHandle(Greeter.class)
  .call(Greeter::greet, new Greeting("Alice"));

// Use send() for one-way invocation without waiting
SendResponse<GreetingResponse> sendResponse = client.serviceHandle(Greeter.class)
  .send(Greeter::greet, new Greeting("Alice"));

For simple synchronous request-response interactions, consider using service instead.

Return

a handle to invoke the service with advanced options

Parameters

clazz

the service class annotated with Service