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 classprotected static interfaceNested classes/interfaces inherited from interface dev.restate.client.Client
Client.AwakeableHandle, Client.IdempotentInvocationHandle<Res>, Client.InvocationHandle<Res>, Client.WorkflowHandle<Res> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBaseClient(URI baseUri, @Nullable SerdeFactory serdeFactory, @Nullable RequestOptions baseOptions) -
Method Summary
Modifier and TypeMethodDescriptionCreate a newClient.AwakeableHandlefor 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.IdempotentInvocationHandlefor the provided target and idempotency key.<Res> Client.InvocationHandle<Res> invocationHandle(String invocationId, TypeTag<Res> resTypeTag) Create a newClient.InvocationHandlefor 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.WorkflowHandlefor the provided workflow name and identifier.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:ClientFuture version ofClient.call(Request) -
sendAsync
public <Req,Res> CompletableFuture<SendResponse<Res>> sendAsync(Request<Req, Res> request, @Nullable Duration delay) Description copied from interface:ClientFuture version ofClient.send(Request, Duration) -
awakeableHandle
Description copied from interface:ClientCreate a newClient.AwakeableHandlefor the provided identifier. You can use it toClient.AwakeableHandle.resolve(TypeTag, Object)orClient.AwakeableHandle.reject(String)an Awakeable from the ingress.- Specified by:
awakeableHandlein interfaceClient
-
invocationHandle
public <Res> Client.InvocationHandle<Res> invocationHandle(String invocationId, TypeTag<Res> resTypeTag) Description copied from interface:ClientCreate a newClient.InvocationHandlefor the provided invocation identifier.- Specified by:
invocationHandlein 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:ClientCreate a newClient.IdempotentInvocationHandlefor the provided target and idempotency key.- Specified by:
idempotentInvocationHandlein 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:ClientCreate a newClient.WorkflowHandlefor the provided workflow name and identifier.- Specified by:
workflowHandlein 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)
-