Package dev.restate.client.base
Class BaseClient
java.lang.Object
dev.restate.client.base.BaseClient
- All Implemented Interfaces:
Client
- Direct Known Subclasses:
JdkClient
Base client. This can be used to build
Client
implementations on top with the HTTP client
of your choice.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
protected static interface
Nested classes/interfaces inherited from interface dev.restate.client.Client
Client.AwakeableHandle, Client.IdempotentInvocationHandle<Res>, Client.InvocationHandle<Res>, Client.WorkflowHandle<Res>
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BaseClient
(URI baseUri, @Nullable SerdeFactory serdeFactory, @Nullable RequestOptions baseOptions) -
Method Summary
Modifier and TypeMethodDescriptionCreate a newClient.AwakeableHandle
for the provided identifier.<Req,
Res> CompletableFuture <Response<Res>> Future version ofClient.call(Request)
protected abstract <Res> CompletableFuture
<Res> doGetRequest
(URI target, Stream<Map.Entry<String, String>> headers, BaseClient.ResponseMapper<Res> responseMapper) protected abstract <Res> CompletableFuture
<Res> doPostRequest
(URI target, Stream<Map.Entry<String, String>> headers, Slice payload, BaseClient.ResponseMapper<Res> responseMapper) <Res> Client.IdempotentInvocationHandle
<Res> idempotentInvocationHandle
(Target target, String idempotencyKey, TypeTag<Res> resTypeTag) Create a newClient.IdempotentInvocationHandle
for the provided target and idempotency key.<Res> Client.InvocationHandle
<Res> invocationHandle
(String invocationId, TypeTag<Res> resTypeTag) Create a newClient.InvocationHandle
for the provided invocation identifier.<Req,
Res> CompletableFuture <SendResponse<Res>> Future version ofClient.send(Request, Duration)
<Res> Client.WorkflowHandle
<Res> workflowHandle
(String workflowName, String workflowId, TypeTag<Res> resTypeTag) Create a newClient.WorkflowHandle
for the provided workflow name and identifier.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.restate.client.Client
call, idempotentInvocationHandle, invocationHandle, send, send, sendAsync, submit, submit, submitAsync, submitAsync, workflowHandle
-
Constructor Details
-
BaseClient
protected BaseClient(URI baseUri, @Nullable SerdeFactory serdeFactory, @Nullable RequestOptions baseOptions)
-
-
Method Details
-
callAsync
Description copied from interface:Client
Future version ofClient.call(Request)
-
sendAsync
public <Req,Res> CompletableFuture<SendResponse<Res>> sendAsync(Request<Req, Res> request, @Nullable Duration delay) Description copied from interface:Client
Future version ofClient.send(Request, Duration)
-
awakeableHandle
Description copied from interface:Client
Create a newClient.AwakeableHandle
for the provided identifier. You can use it toClient.AwakeableHandle.resolve(TypeTag, Object)
orClient.AwakeableHandle.reject(String)
an Awakeable from the ingress.- Specified by:
awakeableHandle
in interfaceClient
-
invocationHandle
public <Res> Client.InvocationHandle<Res> invocationHandle(String invocationId, TypeTag<Res> resTypeTag) Description copied from interface:Client
Create a newClient.InvocationHandle
for the provided invocation identifier.- Specified by:
invocationHandle
in interfaceClient
- Parameters:
invocationId
- the invocation identifierresTypeTag
- type tag used to deserialize the invocation result- Returns:
- the invocation handle
-
idempotentInvocationHandle
public <Res> Client.IdempotentInvocationHandle<Res> idempotentInvocationHandle(Target target, String idempotencyKey, TypeTag<Res> resTypeTag) Description copied from interface:Client
Create a newClient.IdempotentInvocationHandle
for the provided target and idempotency key.- Specified by:
idempotentInvocationHandle
in interfaceClient
- Parameters:
target
- the target service/methodidempotencyKey
- the idempotency keyresTypeTag
- type tag used to deserialize the invocation result- Returns:
- the idempotent invocation handle
-
workflowHandle
public <Res> Client.WorkflowHandle<Res> workflowHandle(String workflowName, String workflowId, TypeTag<Res> resTypeTag) Description copied from interface:Client
Create a newClient.WorkflowHandle
for the provided workflow name and identifier.- Specified by:
workflowHandle
in interfaceClient
- Parameters:
workflowName
- the workflow nameworkflowId
- the workflow identifierresTypeTag
- type tag used to deserialize the invocation result- Returns:
- the workflow handle
-
doPostRequest
protected abstract <Res> CompletableFuture<Res> doPostRequest(URI target, Stream<Map.Entry<String, String>> headers, Slice payload, BaseClient.ResponseMapper<Res> responseMapper) -
doGetRequest
protected abstract <Res> CompletableFuture<Res> doGetRequest(URI target, Stream<Map.Entry<String, String>> headers, BaseClient.ResponseMapper<Res> responseMapper)
-