Interface ServiceHandle<SVC>

Type Parameters:
SVC - the service interface type

public interface ServiceHandle<SVC>
Advanced API handle for invoking Restate services, virtual objects, or workflows with full control. This handle provides advanced invocation capabilities including:
  • Composable futures for asynchronous request handling
  • Invocation options such as idempotency keys
  • Fire-and-forget requests via send()
  • Deferred response handling

Use this handle to perform requests with method references:

// 1. Use call() with method reference and await the result
GreetingResponse response = Restate.serviceHandle(Greeter.class)
  .call(Greeter::greet, new Greeting("Alice"))
  .await();

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

Create instances using Restate.serviceHandle(Class), Restate.virtualObjectHandle(Class, String), or Restate.workflowHandle(Class, String).

For simple synchronous request-response interactions, consider using the simple proxy API instead: Restate.service(Class), Restate.virtualObject(Class, String), or Restate.workflow(Class, String).