ClientServiceHandle
Advanced API handle for invoking Restate services, virtual objects, or workflows from the ingress (outside of a handler). This handle 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
Use this handle to perform requests with method references:
Client client = Client.connect("http://localhost:8080");
// 1. Use call() with method reference and wait for the result
Response<GreetingResponse> response = client.serviceHandle(Greeter.class)
.call(Greeter::greet, new Greeting("Alice"));
// 2. Use send() for one-way invocation without waiting
SendResponse<GreetingResponse> sendResponse = client.serviceHandle(Greeter.class)
.send(Greeter::greet, new Greeting("Alice"));
Content copied to clipboard
Create instances using serviceHandle, virtualObjectHandle, or workflowHandle.
For simple synchronous request-response interactions returning just the output, consider using the simple proxy API instead: service, virtualObject, or workflow.
Parameters
<SVC>
the service interface type
Functions
Link copied to clipboard
open fun <I> call(s: BiConsumer<SVC, I>, input: I, invocationOptions: InvocationOptions): Response<Void>
open fun <I> call(s: BiConsumer<SVC, I>, input: I, options: InvocationOptions.Builder): Response<Void>
open fun <I, O> call(s: BiFunction<SVC, I, O>, input: I, invocationOptions: InvocationOptions): Response<O>
open fun <I, O> call(s: BiFunction<SVC, I, O>, input: I, options: InvocationOptions.Builder): Response<O>
Invoke a service method with input and wait for the response.
Link copied to clipboard
abstract fun callAsync(s: Consumer<SVC>, invocationOptions: InvocationOptions): CompletableFuture<Response<Void>>
open fun callAsync(s: Consumer<SVC>, options: InvocationOptions.Builder): CompletableFuture<Response<Void>>
abstract fun <O> callAsync(s: (SVC) -> O, invocationOptions: InvocationOptions): CompletableFuture<Response<O>>
open fun <O> callAsync(s: (SVC) -> O, options: InvocationOptions.Builder): CompletableFuture<Response<O>>
abstract fun <I> callAsync(s: BiConsumer<SVC, I>, input: I, invocationOptions: InvocationOptions): CompletableFuture<Response<Void>>
open fun <I> callAsync(s: BiConsumer<SVC, I>, input: I, options: InvocationOptions.Builder): CompletableFuture<Response<Void>>
abstract fun <I, O> callAsync(s: BiFunction<SVC, I, O>, input: I, invocationOptions: InvocationOptions): CompletableFuture<Response<O>>
open fun <I, O> callAsync(s: BiFunction<SVC, I, O>, input: I, options: InvocationOptions.Builder): CompletableFuture<Response<O>>
Link copied to clipboard
Like send, for methods without input or return value.
Like send, for methods without input.
Like send, for methods without a return value.
Send a one-way invocation without waiting for the response.
open fun <I> send(s: BiConsumer<SVC, I>, input: I, invocationOptions: InvocationOptions): SendResponse<Void>
open fun <I> send(s: BiConsumer<SVC, I>, input: I, options: InvocationOptions.Builder): SendResponse<Void>
open fun <I, O> send(s: BiFunction<SVC, I, O>, input: I, invocationOptions: InvocationOptions): SendResponse<O>
open fun <I, O> send(s: BiFunction<SVC, I, O>, input: I, options: InvocationOptions.Builder): SendResponse<O>
Like send, with invocation options.
Like send, with a delay.
open fun send(s: Consumer<SVC>, delay: Duration, invocationOptions: InvocationOptions): SendResponse<Void>
open fun send(s: Consumer<SVC>, delay: Duration, options: InvocationOptions.Builder): SendResponse<Void>
open fun <O> send(s: (SVC) -> O, delay: Duration, invocationOptions: InvocationOptions): SendResponse<O>
open fun <O> send(s: (SVC) -> O, delay: Duration, options: InvocationOptions.Builder): SendResponse<O>
open fun <I> send(s: BiConsumer<SVC, I>, input: I, delay: Duration, invocationOptions: InvocationOptions): SendResponse<Void>
open fun <I> send(s: BiConsumer<SVC, I>, input: I, delay: Duration, options: InvocationOptions.Builder): SendResponse<Void>
open fun <I, O> send(s: BiFunction<SVC, I, O>, input: I, delay: Duration, invocationOptions: InvocationOptions): SendResponse<O>
open fun <I, O> send(s: BiFunction<SVC, I, O>, input: I, delay: Duration, options: InvocationOptions.Builder): SendResponse<O>
Like send, with a delay and invocation options.
Link copied to clipboard
Like sendAsync, for no-input/void methods.
Like sendAsync, for no-input methods.
Like sendAsync, for void methods.
Async version of send.
open fun sendAsync(s: Consumer<SVC>, invocationOptions: InvocationOptions): CompletableFuture<SendResponse<Void>>
open fun sendAsync(s: Consumer<SVC>, options: InvocationOptions.Builder): CompletableFuture<SendResponse<Void>>
open fun <O> sendAsync(s: (SVC) -> O, invocationOptions: InvocationOptions): CompletableFuture<SendResponse<O>>
open fun <O> sendAsync(s: (SVC) -> O, options: InvocationOptions.Builder): CompletableFuture<SendResponse<O>>
open fun <I> sendAsync(s: BiConsumer<SVC, I>, input: I, invocationOptions: InvocationOptions): CompletableFuture<SendResponse<Void>>
open fun <I> sendAsync(s: BiConsumer<SVC, I>, input: I, options: InvocationOptions.Builder): CompletableFuture<SendResponse<Void>>
open fun <I, O> sendAsync(s: BiFunction<SVC, I, O>, input: I, invocationOptions: InvocationOptions): CompletableFuture<SendResponse<O>>
open fun <I, O> sendAsync(s: BiFunction<SVC, I, O>, input: I, options: InvocationOptions.Builder): CompletableFuture<SendResponse<O>>
Like sendAsync, with options.
open fun <I> sendAsync(s: BiConsumer<SVC, I>, input: I, delay: Duration): CompletableFuture<SendResponse<Void>>
open fun <I, O> sendAsync(s: BiFunction<SVC, I, O>, input: I, delay: Duration): CompletableFuture<SendResponse<O>>
Like sendAsync, with a delay.
abstract fun sendAsync(s: Consumer<SVC>, delay: Duration, invocationOptions: InvocationOptions): CompletableFuture<SendResponse<Void>>
open fun sendAsync(s: Consumer<SVC>, delay: Duration, options: InvocationOptions.Builder): CompletableFuture<SendResponse<Void>>
abstract fun <O> sendAsync(s: (SVC) -> O, delay: Duration, invocationOptions: InvocationOptions): CompletableFuture<SendResponse<O>>
open fun <O> sendAsync(s: (SVC) -> O, delay: Duration, options: InvocationOptions.Builder): CompletableFuture<SendResponse<O>>
abstract fun <I> sendAsync(s: BiConsumer<SVC, I>, input: I, delay: Duration, invocationOptions: InvocationOptions): CompletableFuture<SendResponse<Void>>
open fun <I> sendAsync(s: BiConsumer<SVC, I>, input: I, delay: Duration, options: InvocationOptions.Builder): CompletableFuture<SendResponse<Void>>
abstract fun <I, O> sendAsync(s: BiFunction<SVC, I, O>, input: I, delay: Duration, invocationOptions: InvocationOptions): CompletableFuture<SendResponse<O>>
open fun <I, O> sendAsync(s: BiFunction<SVC, I, O>, input: I, delay: Duration, options: InvocationOptions.Builder): CompletableFuture<SendResponse<O>>
Like sendAsync, with delay and options.