Package dev.restate.client
Interface ClientServiceHandle<SVC>
- Type Parameters:
SVC- the service interface type
@Experimental
public interface ClientServiceHandle<SVC>
EXPERIMENTAL API: This interface is part of the new reflection-based API and may change in
future releases.
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
Responsemetadata
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"));
Create instances using Client.serviceHandle(Class), Client.virtualObjectHandle(Class, String), or Client.workflowHandle(Class, String).
For simple synchronous request-response interactions returning just the output, consider using
the simple proxy API instead: Client.service(Class), Client.virtualObject(Class, String), or Client.workflow(Class, String).
-
Method Summary
Modifier and TypeMethodDescriptioncall(BiConsumer<SVC, I> s, I input) call(BiConsumer<SVC, I> s, I input, InvocationOptions invocationOptions) call(BiConsumer<SVC, I> s, I input, InvocationOptions.Builder options) default <I,O> Response <O> call(BiFunction<SVC, I, O> s, I input) EXPERIMENTAL API: Invoke a service method with input and wait for the response.default <I,O> Response <O> call(BiFunction<SVC, I, O> s, I input, InvocationOptions invocationOptions) default <I,O> Response <O> call(BiFunction<SVC, I, O> s, I input, InvocationOptions.Builder options) call(Consumer<SVC> s, InvocationOptions invocationOptions) call(Consumer<SVC> s, InvocationOptions.Builder options) default <O> Response<O> default <O> Response<O> call(Function<SVC, O> s, InvocationOptions invocationOptions) default <O> Response<O> call(Function<SVC, O> s, InvocationOptions.Builder options) default <I> CompletableFuture<Response<Void>> callAsync(BiConsumer<SVC, I> s, I input) <I> CompletableFuture<Response<Void>> callAsync(BiConsumer<SVC, I> s, I input, InvocationOptions invocationOptions) default <I> CompletableFuture<Response<Void>> callAsync(BiConsumer<SVC, I> s, I input, InvocationOptions.Builder options) default <I,O> CompletableFuture <Response<O>> callAsync(BiFunction<SVC, I, O> s, I input) <I,O> CompletableFuture <Response<O>> callAsync(BiFunction<SVC, I, O> s, I input, InvocationOptions invocationOptions) default <I,O> CompletableFuture <Response<O>> callAsync(BiFunction<SVC, I, O> s, I input, InvocationOptions.Builder options) default CompletableFuture<Response<Void>> callAsync(Consumer<SVC> s, InvocationOptions invocationOptions) default CompletableFuture<Response<Void>> callAsync(Consumer<SVC> s, InvocationOptions.Builder options) default <O> CompletableFuture<Response<O>> <O> CompletableFuture<Response<O>> callAsync(Function<SVC, O> s, InvocationOptions invocationOptions) default <O> CompletableFuture<Response<O>> callAsync(Function<SVC, O> s, InvocationOptions.Builder options) default <I> SendResponse<Void> send(BiConsumer<SVC, I> s, I input) EXPERIMENTAL API: Likesend(BiFunction, Object), for methods without a return value.default <I> SendResponse<Void> send(BiConsumer<SVC, I> s, I input, InvocationOptions invocationOptions) EXPERIMENTAL API: Likesend(BiConsumer, Object), with invocation options.default <I> SendResponse<Void> send(BiConsumer<SVC, I> s, I input, InvocationOptions.Builder options) EXPERIMENTAL API: Likesend(BiConsumer, Object), with invocation options.default <I> SendResponse<Void> send(BiConsumer<SVC, I> s, I input, Duration delay) EXPERIMENTAL API: Likesend(BiConsumer, Object), with a delay.default <I> SendResponse<Void> send(BiConsumer<SVC, I> s, I input, Duration delay, InvocationOptions invocationOptions) EXPERIMENTAL API: Likesend(BiConsumer, Object), with a delay and invocation options.default <I> SendResponse<Void> send(BiConsumer<SVC, I> s, I input, Duration delay, InvocationOptions.Builder options) EXPERIMENTAL API: Likesend(BiConsumer, Object), with a delay and invocation options.default <I,O> SendResponse <O> send(BiFunction<SVC, I, O> s, I input) EXPERIMENTAL API: Send a one-way invocation without waiting for the response.default <I,O> SendResponse <O> send(BiFunction<SVC, I, O> s, I input, InvocationOptions invocationOptions) EXPERIMENTAL API: Likesend(BiFunction, Object), with invocation options.default <I,O> SendResponse <O> send(BiFunction<SVC, I, O> s, I input, InvocationOptions.Builder options) EXPERIMENTAL API: Likesend(BiFunction, Object), with invocation options.default <I,O> SendResponse <O> send(BiFunction<SVC, I, O> s, I input, Duration delay) EXPERIMENTAL API: Likesend(BiFunction, Object), with a delay.default <I,O> SendResponse <O> send(BiFunction<SVC, I, O> s, I input, Duration delay, InvocationOptions invocationOptions) EXPERIMENTAL API: Likesend(BiFunction, Object), with a delay and invocation options.default <I,O> SendResponse <O> send(BiFunction<SVC, I, O> s, I input, Duration delay, InvocationOptions.Builder options) EXPERIMENTAL API: Likesend(BiFunction, Object), with a delay and invocation options.default SendResponse<Void> EXPERIMENTAL API: Likesend(BiFunction, Object), for methods without input or return value.default SendResponse<Void> send(Consumer<SVC> s, InvocationOptions invocationOptions) EXPERIMENTAL API: Likesend(Consumer), with invocation options.default SendResponse<Void> send(Consumer<SVC> s, InvocationOptions.Builder options) EXPERIMENTAL API: Likesend(Consumer), with invocation options.default SendResponse<Void> EXPERIMENTAL API: Likesend(Consumer), with a delay.default SendResponse<Void> send(Consumer<SVC> s, Duration delay, InvocationOptions invocationOptions) EXPERIMENTAL API: Likesend(Consumer), with a delay and invocation options.default SendResponse<Void> send(Consumer<SVC> s, Duration delay, InvocationOptions.Builder options) EXPERIMENTAL API: Likesend(Consumer), with a delay and invocation options.default <O> SendResponse<O> EXPERIMENTAL API: Likesend(BiFunction, Object), for methods without input.default <O> SendResponse<O> send(Function<SVC, O> s, InvocationOptions invocationOptions) EXPERIMENTAL API: Likesend(Function), with invocation options.default <O> SendResponse<O> send(Function<SVC, O> s, InvocationOptions.Builder options) EXPERIMENTAL API: Likesend(Function), with invocation options.default <O> SendResponse<O> EXPERIMENTAL API: Likesend(Function), with a delay.default <O> SendResponse<O> send(Function<SVC, O> s, Duration delay, InvocationOptions invocationOptions) EXPERIMENTAL API: Likesend(Function), with a delay and invocation options.default <O> SendResponse<O> send(Function<SVC, O> s, Duration delay, InvocationOptions.Builder options) EXPERIMENTAL API: Likesend(Function), with a delay and invocation options.default <I> CompletableFuture<SendResponse<Void>> sendAsync(BiConsumer<SVC, I> s, I input) EXPERIMENTAL API: LikesendAsync(BiFunction, Object), for void methods.default <I> CompletableFuture<SendResponse<Void>> sendAsync(BiConsumer<SVC, I> s, I input, InvocationOptions invocationOptions) EXPERIMENTAL API: LikesendAsync(BiConsumer, Object), with options.default <I> CompletableFuture<SendResponse<Void>> sendAsync(BiConsumer<SVC, I> s, I input, InvocationOptions.Builder options) EXPERIMENTAL API: LikesendAsync(BiConsumer, Object), with options.default <I> CompletableFuture<SendResponse<Void>> sendAsync(BiConsumer<SVC, I> s, I input, Duration delay) EXPERIMENTAL API: LikesendAsync(BiConsumer, Object), with a delay.sendAsync(BiConsumer<SVC, I> s, I input, Duration delay, InvocationOptions invocationOptions) EXPERIMENTAL API: LikesendAsync(BiConsumer, Object), with delay and options.default <I> CompletableFuture<SendResponse<Void>> sendAsync(BiConsumer<SVC, I> s, I input, Duration delay, InvocationOptions.Builder options) EXPERIMENTAL API: LikesendAsync(BiConsumer, Object), with delay and options.default <I,O> CompletableFuture <SendResponse<O>> sendAsync(BiFunction<SVC, I, O> s, I input) EXPERIMENTAL API: Async version ofsend(BiFunction, Object).default <I,O> CompletableFuture <SendResponse<O>> sendAsync(BiFunction<SVC, I, O> s, I input, InvocationOptions invocationOptions) EXPERIMENTAL API: LikesendAsync(BiFunction, Object), with options.default <I,O> CompletableFuture <SendResponse<O>> sendAsync(BiFunction<SVC, I, O> s, I input, InvocationOptions.Builder options) EXPERIMENTAL API: LikesendAsync(BiFunction, Object), with options.default <I,O> CompletableFuture <SendResponse<O>> sendAsync(BiFunction<SVC, I, O> s, I input, Duration delay) EXPERIMENTAL API: LikesendAsync(BiFunction, Object), with a delay.<I,O> CompletableFuture <SendResponse<O>> sendAsync(BiFunction<SVC, I, O> s, I input, Duration delay, InvocationOptions invocationOptions) EXPERIMENTAL API: LikesendAsync(BiFunction, Object), with delay and options.default <I,O> CompletableFuture <SendResponse<O>> sendAsync(BiFunction<SVC, I, O> s, I input, Duration delay, InvocationOptions.Builder options) EXPERIMENTAL API: LikesendAsync(BiFunction, Object), with delay and options.default CompletableFuture<SendResponse<Void>> EXPERIMENTAL API: LikesendAsync(BiFunction, Object), for no-input/void methods.default CompletableFuture<SendResponse<Void>> sendAsync(Consumer<SVC> s, InvocationOptions invocationOptions) EXPERIMENTAL API: LikesendAsync(Consumer), with options.default CompletableFuture<SendResponse<Void>> sendAsync(Consumer<SVC> s, InvocationOptions.Builder options) EXPERIMENTAL API: LikesendAsync(Consumer), with options.default CompletableFuture<SendResponse<Void>> EXPERIMENTAL API: LikesendAsync(Consumer), with a delay.sendAsync(Consumer<SVC> s, Duration delay, InvocationOptions invocationOptions) EXPERIMENTAL API: LikesendAsync(Consumer), with delay and options.default CompletableFuture<SendResponse<Void>> sendAsync(Consumer<SVC> s, Duration delay, InvocationOptions.Builder options) EXPERIMENTAL API: LikesendAsync(Consumer), with delay and options.default <O> CompletableFuture<SendResponse<O>> EXPERIMENTAL API: LikesendAsync(BiFunction, Object), for no-input methods.default <O> CompletableFuture<SendResponse<O>> sendAsync(Function<SVC, O> s, InvocationOptions invocationOptions) EXPERIMENTAL API: LikesendAsync(Function), with options.default <O> CompletableFuture<SendResponse<O>> sendAsync(Function<SVC, O> s, InvocationOptions.Builder options) EXPERIMENTAL API: LikesendAsync(Function), with options.default <O> CompletableFuture<SendResponse<O>> EXPERIMENTAL API: LikesendAsync(Function), with a delay.<O> CompletableFuture<SendResponse<O>> sendAsync(Function<SVC, O> s, Duration delay, InvocationOptions invocationOptions) EXPERIMENTAL API: LikesendAsync(Function), with delay and options.default <O> CompletableFuture<SendResponse<O>> sendAsync(Function<SVC, O> s, Duration delay, InvocationOptions.Builder options) EXPERIMENTAL API: LikesendAsync(Function), with delay and options.
-
Method Details
-
call
EXPERIMENTAL API: Invoke a service method with input and wait for the response.// Call with method reference and input Response<GreetingResponse> response = client.service(Greeter.class) .call(Greeter::greet, new Greeting("Alice"));- Parameters:
s- method reference (e.g.,Greeter::greet)input- the input parameter to pass to the method- Returns:
- a
Responsewrapping the result
-
call
@Experimental default <I,O> Response<O> call(BiFunction<SVC, I, O> s, I input, InvocationOptions.Builder options) -
call
@Experimental default <I,O> Response<O> call(BiFunction<SVC, I, O> s, I input, InvocationOptions invocationOptions) -
call
-
call
@Experimental default <I> Response<Void> call(BiConsumer<SVC, I> s, I input, InvocationOptions.Builder options) -
call
@Experimental default <I> Response<Void> call(BiConsumer<SVC, I> s, I input, InvocationOptions invocationOptions) -
call
-
call
-
call
-
call
-
call
-
call
-
callAsync
@Experimental default <I,O> CompletableFuture<Response<O>> callAsync(BiFunction<SVC, I, O> s, I input) -
callAsync
@Experimental default <I,O> CompletableFuture<Response<O>> callAsync(BiFunction<SVC, I, O> s, I input, InvocationOptions.Builder options) -
callAsync
@Experimental <I,O> CompletableFuture<Response<O>> callAsync(BiFunction<SVC, I, O> s, I input, InvocationOptions invocationOptions) -
callAsync
-
callAsync
@Experimental default <I> CompletableFuture<Response<Void>> callAsync(BiConsumer<SVC, I> s, I input, InvocationOptions.Builder options) -
callAsync
@Experimental <I> CompletableFuture<Response<Void>> callAsync(BiConsumer<SVC, I> s, I input, InvocationOptions invocationOptions) -
callAsync
-
callAsync
@Experimental default <O> CompletableFuture<Response<O>> callAsync(Function<SVC, O> s, InvocationOptions.Builder options) -
callAsync
@Experimental <O> CompletableFuture<Response<O>> callAsync(Function<SVC, O> s, InvocationOptions invocationOptions) -
callAsync
-
callAsync
@Experimental default CompletableFuture<Response<Void>> callAsync(Consumer<SVC> s, InvocationOptions.Builder options) -
callAsync
@Experimental CompletableFuture<Response<Void>> callAsync(Consumer<SVC> s, InvocationOptions invocationOptions) -
send
EXPERIMENTAL API: Send a one-way invocation without waiting for the response.// Send without waiting for response SendResponse<GreetingResponse> sendResponse = client.service(Greeter.class) .send(Greeter::greet, new Greeting("Alice")); -
send
@Experimental default <I,O> SendResponse<O> send(BiFunction<SVC, I, O> s, I input, InvocationOptions.Builder options) EXPERIMENTAL API: Likesend(BiFunction, Object), with invocation options. -
send
@Experimental default <I,O> SendResponse<O> send(BiFunction<SVC, I, O> s, I input, InvocationOptions invocationOptions) EXPERIMENTAL API: Likesend(BiFunction, Object), with invocation options. -
send
EXPERIMENTAL API: Likesend(BiFunction, Object), with a delay. -
send
@Experimental default <I,O> SendResponse<O> send(BiFunction<SVC, I, O> s, I input, Duration delay, InvocationOptions.Builder options) EXPERIMENTAL API: Likesend(BiFunction, Object), with a delay and invocation options. -
send
@Experimental default <I,O> SendResponse<O> send(BiFunction<SVC, I, O> s, I input, Duration delay, InvocationOptions invocationOptions) EXPERIMENTAL API: Likesend(BiFunction, Object), with a delay and invocation options. -
send
EXPERIMENTAL API: Likesend(BiFunction, Object), for methods without a return value. -
send
@Experimental default <I> SendResponse<Void> send(BiConsumer<SVC, I> s, I input, InvocationOptions.Builder options) EXPERIMENTAL API: Likesend(BiConsumer, Object), with invocation options. -
send
@Experimental default <I> SendResponse<Void> send(BiConsumer<SVC, I> s, I input, InvocationOptions invocationOptions) EXPERIMENTAL API: Likesend(BiConsumer, Object), with invocation options. -
send
EXPERIMENTAL API: Likesend(BiConsumer, Object), with a delay. -
send
@Experimental default <I> SendResponse<Void> send(BiConsumer<SVC, I> s, I input, Duration delay, InvocationOptions.Builder options) EXPERIMENTAL API: Likesend(BiConsumer, Object), with a delay and invocation options. -
send
@Experimental default <I> SendResponse<Void> send(BiConsumer<SVC, I> s, I input, Duration delay, InvocationOptions invocationOptions) EXPERIMENTAL API: Likesend(BiConsumer, Object), with a delay and invocation options. -
send
EXPERIMENTAL API: Likesend(BiFunction, Object), for methods without input. -
send
@Experimental default <O> SendResponse<O> send(Function<SVC, O> s, InvocationOptions.Builder options) EXPERIMENTAL API: Likesend(Function), with invocation options. -
send
@Experimental default <O> SendResponse<O> send(Function<SVC, O> s, InvocationOptions invocationOptions) EXPERIMENTAL API: Likesend(Function), with invocation options. -
send
EXPERIMENTAL API: Likesend(Function), with a delay. -
send
@Experimental default <O> SendResponse<O> send(Function<SVC, O> s, Duration delay, InvocationOptions.Builder options) EXPERIMENTAL API: Likesend(Function), with a delay and invocation options. -
send
@Experimental default <O> SendResponse<O> send(Function<SVC, O> s, Duration delay, InvocationOptions invocationOptions) EXPERIMENTAL API: Likesend(Function), with a delay and invocation options. -
send
EXPERIMENTAL API: Likesend(BiFunction, Object), for methods without input or return value. -
send
EXPERIMENTAL API: Likesend(Consumer), with invocation options. -
send
EXPERIMENTAL API: Likesend(Consumer), with invocation options. -
send
EXPERIMENTAL API: Likesend(Consumer), with a delay. -
send
@Experimental default SendResponse<Void> send(Consumer<SVC> s, Duration delay, InvocationOptions.Builder options) EXPERIMENTAL API: Likesend(Consumer), with a delay and invocation options. -
send
@Experimental default SendResponse<Void> send(Consumer<SVC> s, Duration delay, InvocationOptions invocationOptions) EXPERIMENTAL API: Likesend(Consumer), with a delay and invocation options. -
sendAsync
@Experimental default <I,O> CompletableFuture<SendResponse<O>> sendAsync(BiFunction<SVC, I, O> s, I input) EXPERIMENTAL API: Async version ofsend(BiFunction, Object). -
sendAsync
@Experimental default <I,O> CompletableFuture<SendResponse<O>> sendAsync(BiFunction<SVC, I, O> s, I input, InvocationOptions.Builder options) EXPERIMENTAL API: LikesendAsync(BiFunction, Object), with options. -
sendAsync
@Experimental default <I,O> CompletableFuture<SendResponse<O>> sendAsync(BiFunction<SVC, I, O> s, I input, InvocationOptions invocationOptions) EXPERIMENTAL API: LikesendAsync(BiFunction, Object), with options. -
sendAsync
@Experimental default <I,O> CompletableFuture<SendResponse<O>> sendAsync(BiFunction<SVC, I, O> s, I input, Duration delay) EXPERIMENTAL API: LikesendAsync(BiFunction, Object), with a delay. -
sendAsync
@Experimental default <I,O> CompletableFuture<SendResponse<O>> sendAsync(BiFunction<SVC, I, O> s, I input, Duration delay, InvocationOptions.Builder options) EXPERIMENTAL API: LikesendAsync(BiFunction, Object), with delay and options. -
sendAsync
@Experimental <I,O> CompletableFuture<SendResponse<O>> sendAsync(BiFunction<SVC, I, O> s, I input, Duration delay, InvocationOptions invocationOptions) EXPERIMENTAL API: LikesendAsync(BiFunction, Object), with delay and options. -
sendAsync
@Experimental default <I> CompletableFuture<SendResponse<Void>> sendAsync(BiConsumer<SVC, I> s, I input) EXPERIMENTAL API: LikesendAsync(BiFunction, Object), for void methods. -
sendAsync
@Experimental default <I> CompletableFuture<SendResponse<Void>> sendAsync(BiConsumer<SVC, I> s, I input, InvocationOptions.Builder options) EXPERIMENTAL API: LikesendAsync(BiConsumer, Object), with options. -
sendAsync
@Experimental default <I> CompletableFuture<SendResponse<Void>> sendAsync(BiConsumer<SVC, I> s, I input, InvocationOptions invocationOptions) EXPERIMENTAL API: LikesendAsync(BiConsumer, Object), with options. -
sendAsync
@Experimental default <I> CompletableFuture<SendResponse<Void>> sendAsync(BiConsumer<SVC, I> s, I input, Duration delay) EXPERIMENTAL API: LikesendAsync(BiConsumer, Object), with a delay. -
sendAsync
@Experimental default <I> CompletableFuture<SendResponse<Void>> sendAsync(BiConsumer<SVC, I> s, I input, Duration delay, InvocationOptions.Builder options) EXPERIMENTAL API: LikesendAsync(BiConsumer, Object), with delay and options. -
sendAsync
@Experimental <I> CompletableFuture<SendResponse<Void>> sendAsync(BiConsumer<SVC, I> s, I input, Duration delay, InvocationOptions invocationOptions) EXPERIMENTAL API: LikesendAsync(BiConsumer, Object), with delay and options. -
sendAsync
EXPERIMENTAL API: LikesendAsync(BiFunction, Object), for no-input methods. -
sendAsync
@Experimental default <O> CompletableFuture<SendResponse<O>> sendAsync(Function<SVC, O> s, InvocationOptions.Builder options) EXPERIMENTAL API: LikesendAsync(Function), with options. -
sendAsync
@Experimental default <O> CompletableFuture<SendResponse<O>> sendAsync(Function<SVC, O> s, InvocationOptions invocationOptions) EXPERIMENTAL API: LikesendAsync(Function), with options. -
sendAsync
@Experimental default <O> CompletableFuture<SendResponse<O>> sendAsync(Function<SVC, O> s, Duration delay) EXPERIMENTAL API: LikesendAsync(Function), with a delay. -
sendAsync
@Experimental default <O> CompletableFuture<SendResponse<O>> sendAsync(Function<SVC, O> s, Duration delay, InvocationOptions.Builder options) EXPERIMENTAL API: LikesendAsync(Function), with delay and options. -
sendAsync
@Experimental <O> CompletableFuture<SendResponse<O>> sendAsync(Function<SVC, O> s, Duration delay, InvocationOptions invocationOptions) EXPERIMENTAL API: LikesendAsync(Function), with delay and options. -
sendAsync
EXPERIMENTAL API: LikesendAsync(BiFunction, Object), for no-input/void methods. -
sendAsync
@Experimental default CompletableFuture<SendResponse<Void>> sendAsync(Consumer<SVC> s, InvocationOptions.Builder options) EXPERIMENTAL API: LikesendAsync(Consumer), with options. -
sendAsync
@Experimental default CompletableFuture<SendResponse<Void>> sendAsync(Consumer<SVC> s, InvocationOptions invocationOptions) EXPERIMENTAL API: LikesendAsync(Consumer), with options. -
sendAsync
@Experimental default CompletableFuture<SendResponse<Void>> sendAsync(Consumer<SVC> s, Duration delay) EXPERIMENTAL API: LikesendAsync(Consumer), with a delay. -
sendAsync
@Experimental default CompletableFuture<SendResponse<Void>> sendAsync(Consumer<SVC> s, Duration delay, InvocationOptions.Builder options) EXPERIMENTAL API: LikesendAsync(Consumer), with delay and options. -
sendAsync
@Experimental CompletableFuture<SendResponse<Void>> sendAsync(Consumer<SVC> s, Duration delay, InvocationOptions invocationOptions) EXPERIMENTAL API: LikesendAsync(Consumer), with delay and options.
-