|
1 | 1 | package io.temporal.client; |
2 | 2 |
|
3 | | -import io.grpc.Deadline; |
4 | | -import io.temporal.api.workflowservice.v1.*; |
| 3 | +import io.temporal.client.NexusClientInterceptor.CountNexusOperationExecutionsInput; |
| 4 | +import io.temporal.client.NexusClientInterceptor.CountNexusOperationExecutionsOutput; |
| 5 | +import io.temporal.client.NexusClientInterceptor.DeleteNexusOperationExecutionInput; |
| 6 | +import io.temporal.client.NexusClientInterceptor.DescribeNexusOperationExecutionInput; |
| 7 | +import io.temporal.client.NexusClientInterceptor.DescribeNexusOperationExecutionOutput; |
| 8 | +import io.temporal.client.NexusClientInterceptor.ListNexusOperationExecutionsInput; |
| 9 | +import io.temporal.client.NexusClientInterceptor.ListNexusOperationExecutionsOutput; |
| 10 | +import io.temporal.client.NexusClientInterceptor.PollNexusOperationExecutionInput; |
| 11 | +import io.temporal.client.NexusClientInterceptor.PollNexusOperationExecutionOutput; |
| 12 | +import io.temporal.client.NexusClientInterceptor.RequestCancelNexusOperationExecutionInput; |
| 13 | +import io.temporal.client.NexusClientInterceptor.StartNexusOperationExecutionInput; |
| 14 | +import io.temporal.client.NexusClientInterceptor.StartNexusOperationExecutionOutput; |
| 15 | +import io.temporal.client.NexusClientInterceptor.TerminateNexusOperationExecutionInput; |
5 | 16 | import io.temporal.common.Experimental; |
6 | 17 | import io.temporal.serviceclient.WorkflowServiceStubs; |
7 | | - |
8 | | -import javax.annotation.Nonnull; |
9 | | -import javax.annotation.Nullable; |
10 | 18 | import java.lang.reflect.Type; |
11 | 19 | import java.util.concurrent.CompletableFuture; |
| 20 | +import javax.annotation.Nullable; |
12 | 21 |
|
13 | 22 | /** |
14 | 23 | * Handle for interacting with a standalone Nexus operation execution. |
|
18 | 27 | */ |
19 | 28 | @Experimental |
20 | 29 | public interface NexusClient { |
21 | | - public static NexusClient newInstance(WorkflowServiceStubs service) { |
| 30 | + static NexusClient newInstance(WorkflowServiceStubs service) { |
22 | 31 | return NexusClientImpl.newInstance(service, NexusClientOperationOptions.getDefaultInstance()); |
23 | 32 | } |
24 | 33 |
|
25 | | - //Look at ScheduleClientOptions for an example |
26 | | - public static NexusClient newInstance(WorkflowServiceStubs service, NexusClientOperationOptions options) { |
27 | | - return NexusClientImpl.newInstance(service, options()); |
| 34 | + static NexusClient newInstance( |
| 35 | + WorkflowServiceStubs service, NexusClientOperationOptions options) { |
| 36 | + return NexusClientImpl.newInstance(service, options); |
28 | 37 | } |
29 | 38 |
|
| 39 | + NexusClientHandle getHandle(String scheduleID); |
30 | 40 |
|
31 | | - public NexusClientHandle getHandle(String scheduleID); |
32 | | - |
33 | | - |
34 | | - UntypedNexusClientHandle getHandle( |
35 | | - String operationId, |
36 | | - @Nullable String operationRunId); |
37 | | - |
38 | | - |
39 | | - //Handle is a pointer to an already started workflow |
40 | | - //I will need to create this handle |
41 | | - //Create a NexusOperationHandlerImpl and pass everything needed in |
42 | | - //to create this handle |
43 | | - //Follow what schedule client does |
44 | | - //See it's get handle. etc |
| 41 | + UntypedNexusClientHandle getHandle(String operationId, @Nullable String operationRunId); |
45 | 42 |
|
46 | | - /// Obtains typed handle to existing operations. |
| 43 | + /** Obtains typed handle to existing operations. */ |
47 | 44 | <R> NexusClientHandle<R> getHandle( |
48 | | - String operationId, |
49 | | - @Nullable String operationRunId, |
50 | | - Class<R> resultClass); |
| 45 | + String operationId, @Nullable String operationRunId, Class<R> resultClass); |
51 | 46 |
|
52 | | - /// Obtains typed handle to existing operations. |
53 | | - /// For use with generic return types. |
| 47 | + /** Obtains typed handle to existing operations. For use with generic return types. */ |
54 | 48 | <R> NexusClientHandle<R> getHandle( |
55 | | - String operationId, |
56 | | - @Nullable String operationRunId, |
57 | | - Class<R> resultClass, |
58 | | - @Nullable Type resultType); |
| 49 | + String operationId, |
| 50 | + @Nullable String operationRunId, |
| 51 | + Class<R> resultClass, |
| 52 | + @Nullable Type resultType); |
59 | 53 |
|
60 | | - //untyped -- see the notion doc |
61 | | - //untyped means I don't have the services type, ust the name |
62 | 54 | UntypedNexusServiceClient newUntypeNexusServiceClient(); |
63 | 55 |
|
64 | 56 | <R> NexusServiceClient<R> newNexusServiceClient(); |
65 | 57 |
|
| 58 | + StartNexusOperationExecutionOutput startNexusOperationExecution( |
| 59 | + StartNexusOperationExecutionInput input); |
66 | 60 |
|
| 61 | + DescribeNexusOperationExecutionOutput describeNexusOperationExecution( |
| 62 | + DescribeNexusOperationExecutionInput input); |
67 | 63 |
|
| 64 | + CompletableFuture<DescribeNexusOperationExecutionOutput> describeNexusOperationExecutionAsync( |
| 65 | + DescribeNexusOperationExecutionInput input); |
68 | 66 |
|
69 | | - //ListNexusOperationExecutionsResponse -- look at the go code to see this |
70 | | - //It is everything we expose for a list |
71 | | - //This should call the nexus list operation |
72 | | - //Again, look at schedule client to see or the ListWorkflowExecutionsOutput om WorkflowClientCallsInterceptor |
73 | | -// Stream<NexusOperationExecutionMetadata> listNexusOperations(String query); |
74 | | -// |
75 | | -// NexusOperationExecutionCount countNexusOperations(String query); |
76 | | -//TODO - EVAN |
77 | | - |
78 | | - |
79 | | - StartNexusOperationExecutionResponse startNexusOperationExecution( |
80 | | - @Nonnull StartNexusOperationExecutionRequest request); |
81 | | - |
82 | | - DescribeNexusOperationExecutionResponse describeNexusOperationExecution( |
83 | | - @Nonnull DescribeNexusOperationExecutionRequest request, @Nonnull Deadline deadline); |
84 | | - |
85 | | - CompletableFuture<DescribeNexusOperationExecutionResponse> describeNexusOperationExecutionAsync( |
86 | | - @Nonnull DescribeNexusOperationExecutionRequest request, @Nonnull Deadline deadline); |
87 | | - |
88 | | - PollNexusOperationExecutionResponse pollNexusOperationExecution( |
89 | | - @Nonnull PollNexusOperationExecutionRequest request, @Nonnull Deadline deadline); |
90 | | - |
91 | | - CompletableFuture<PollNexusOperationExecutionResponse> pollNexusOperationExecutionAsync( |
92 | | - @Nonnull PollNexusOperationExecutionRequest request, @Nonnull Deadline deadline); |
| 67 | + PollNexusOperationExecutionOutput pollNexusOperationExecution( |
| 68 | + PollNexusOperationExecutionInput input); |
93 | 69 |
|
94 | | - ListNexusOperationExecutionsResponse listNexusOperationExecutions( |
95 | | - @Nonnull ListNexusOperationExecutionsRequest request); |
| 70 | + CompletableFuture<PollNexusOperationExecutionOutput> pollNexusOperationExecutionAsync( |
| 71 | + PollNexusOperationExecutionInput input); |
96 | 72 |
|
97 | | - CountNexusOperationExecutionsResponse countNexusOperationExecutions( |
98 | | - @Nonnull CountNexusOperationExecutionsRequest request); |
| 73 | + ListNexusOperationExecutionsOutput listNexusOperationExecutions( |
| 74 | + ListNexusOperationExecutionsInput input); |
99 | 75 |
|
100 | | - RequestCancelNexusOperationExecutionResponse requestCancelNexusOperationExecution( |
101 | | - @Nonnull RequestCancelNexusOperationExecutionRequest request); |
| 76 | + CountNexusOperationExecutionsOutput countNexusOperationExecutions( |
| 77 | + CountNexusOperationExecutionsInput input); |
102 | 78 |
|
103 | | - TerminateNexusOperationExecutionResponse terminateNexusOperationExecution( |
104 | | - @Nonnull TerminateNexusOperationExecutionRequest request); |
| 79 | + void requestCancelNexusOperationExecution(RequestCancelNexusOperationExecutionInput input); |
105 | 80 |
|
106 | | - DeleteNexusOperationExecutionResponse deleteNexusOperationExecution( |
107 | | - @Nonnull DeleteNexusOperationExecutionRequest request); |
| 81 | + void terminateNexusOperationExecution(TerminateNexusOperationExecutionInput input); |
108 | 82 |
|
| 83 | + void deleteNexusOperationExecution(DeleteNexusOperationExecutionInput input); |
109 | 84 | } |
0 commit comments