Conversation
| <T> NexusServiceClient<T> newNexusServiceClient(Class<T> serviceInterface, String endpoint); | ||
|
|
||
| /** Start a new standalone Nexus operation execution. */ | ||
| StartNexusOperationExecutionOutput startNexusOperationExecution( |
There was a problem hiding this comment.
This method should not be on the NexusClient
| StartNexusOperationExecutionInput input); | ||
|
|
||
| /** List standalone Nexus operation executions matching a query. */ | ||
| ListNexusOperationExecutionsOutput listNexusOperationExecutions( |
There was a problem hiding this comment.
Client should not be returning interceptor types here, Look at other clients like https://github.com/temporalio/sdk-java/blob/master/temporal-sdk/src/main/java/io/temporal/client/ActivityClient.java#L37
| ListNexusOperationExecutionsOutput listNexusOperationExecutions( | ||
| ListNexusOperationExecutionsInput input); | ||
|
|
||
| /** Count standalone Nexus operation executions matching a query. */ |
There was a problem hiding this comment.
| * NexusClientHandle}; obtain a handle via {@link #getHandle}. | ||
| */ | ||
| @Experimental | ||
| public interface NexusClient { |
There was a problem hiding this comment.
All the methods here should have full Javadocs , see https://github.com/temporalio/sdk-java/blob/master/temporal-sdk/src/main/java/io/temporal/client/ActivityClient.java as an example
| * type binding to an {@link UntypedNexusClientHandle} (returned by {@link | ||
| * NexusClient#getHandle(String)}) by calling one of the {@link #fromUntyped} factories. | ||
| */ | ||
| public interface NexusClientHandle<R> extends UntypedNexusClientHandle { |
There was a problem hiding this comment.
| public interface NexusClientHandle<R> extends UntypedNexusClientHandle { | |
| public interface NexusOperationHandle<R> extends UntypedNexusOperationHandle { |
Please keep consistent naming with other Handles like https://github.com/temporalio/sdk-java/blob/master/temporal-sdk/src/main/java/io/temporal/client/ActivityHandle.java
| import java.util.concurrent.TimeoutException; | ||
| import javax.annotation.Nullable; | ||
|
|
||
| public interface UntypedNexusClientHandle { |
There was a problem hiding this comment.
|
|
||
| void terminate(@Nullable String reason); | ||
|
|
||
| void delete(); |
There was a problem hiding this comment.
Delete shouldn't be included here
| * List operation executions whose service matches the service this client targets. Any | ||
| * user-supplied query is ANDed with a {@code Service="..."} filter. | ||
| */ | ||
| ListNexusOperationExecutionsOutput listNexusOperationExecutions( |
There was a problem hiding this comment.
Listing should be on the NexusClient client not the service client, it is strictly for stating operations, pleas remove
| * Count operation executions whose service matches the service this client targets. Any | ||
| * user-supplied query is ANDed with a {@code Service="..."} filter. | ||
| */ | ||
| CountNexusOperationExecutionsOutput countNexusOperationExecutions( |
There was a problem hiding this comment.
| private final String endpoint; | ||
| private final String service; | ||
| private final String operation; | ||
| private final @Nullable Duration scheduleToCloseTimeout; |
There was a problem hiding this comment.
Don't need to duplicate all the options in NexusClientOperationOptions see ActivityClientCallsInterceptor
| import java.util.List; | ||
| import javax.annotation.Nullable; | ||
|
|
||
| public class NexusClientOperationOptions { |
| import java.util.Objects; | ||
|
|
||
| /** | ||
| * NexusOperationOptions is used to specify the options for starting a Nexus operation from a |
There was a problem hiding this comment.
This shouldn't be renamed
| * Async variant of {@link #start(BiFunction, Object)}. Returns a {@link CompletableFuture} that | ||
| * completes with the typed handle once the start RPC has acknowledged the operation. | ||
| */ | ||
| <U, R> CompletableFuture<NexusClientHandle<R>> startAsync(BiFunction<T, U, R> operation, U input); |
There was a problem hiding this comment.
These variants are not part of proposed API, please remove not every API should have an async variant
| @Override | ||
| public <U, R> java.util.concurrent.CompletableFuture<R> executeAsync( | ||
| BiFunction<T, U, R> operation, U input, NexusOperationOptions options) { | ||
| return startAsync(operation, input, options).thenCompose(NexusClientHandle::getResultAsync); |
There was a problem hiding this comment.
Look at how executeAsync is implemented on ActivityClient
| @Override | ||
| public <U, R> NexusClientHandle<R> start( | ||
| BiFunction<T, U, R> operation, U input, NexusOperationOptions options) { | ||
| OperationCapture<R> capture = captureOperation(operation, input); |
There was a problem hiding this comment.
Look at how stand alone activities code and the newly added https://github.com/temporalio/sdk-java/blob/master/temporal-sdk/src/main/java/io/temporal/internal/util/MethodExtractor.java we should reuse the utility and not re-implment the same logic
| public void applyOnConflictOptions(@Nonnull StartWorkflowExecutionRequest request) { | ||
| update( | ||
| ctx -> { | ||
| OnConflictOptions options = request.getOnConflictOptions(); |
There was a problem hiding this comment.
Unnecessary change
| .build()); | ||
| } | ||
|
|
||
| private Endpoint createEndpoint(String name) { |
There was a problem hiding this comment.
You shouldn't need to create endpoint or delete them per test, the SDKTestWorkflowRule already creates the endpoint for you, this applies to multiple test files from what I can tell
| .setTestTimeoutSeconds(120) | ||
| .build(); | ||
|
|
||
| private NexusClient createNexusClient() { |
There was a problem hiding this comment.
I see multiple tests already need this, I would consider moving it to the SDKTestWorkflowRule
| SDKTestWorkflowRule.newBuilder() | ||
| .setWorkflowTypes(NexusClientTest.PlaceholderWorkflowImpl.class) | ||
| .setNexusServiceImplementation(new TestNexusServiceImpl()) | ||
| // Default is 10s; standalone Nexus dispatch + worker poll can take longer. |
There was a problem hiding this comment.
It shouldn't take over 120s , the default timeout should be fine since we use the same timeout for in workflow nexus operations
| * NexusClient#getHandle(String)}: {@code describe()}, {@code cancel()}/{@code cancel(reason)}, and | ||
| * {@code terminate()}/{@code terminate(reason)}. | ||
| */ | ||
| public class NexusClientHandleTest { |
There was a problem hiding this comment.
This applies to all your tests, but since the time skipping test server doesn't support stand alone nexus operations you need to skip these tests if we are using the time skipping test server using assumeTrue(SDKTestWorkflowRule.useExternalService) on each test file
| private final DataConverter dataConverter; | ||
| private final @Nullable SearchAttributes searchAttributes; | ||
| private final @Nullable String summary; | ||
| private final @Nullable NexusOperationIdReusePolicy idReusePolicy; |
There was a problem hiding this comment.
The options here are not correct, searchAttributes, summary, idReusePolicy, idReusePolicy should be on the per operation options
| import java.util.Collections; | ||
| import java.util.List; | ||
| import javax.annotation.Nullable; | ||
|
|
There was a problem hiding this comment.
Name should be NexusClientOptions
|
|
||
| import io.temporal.common.Experimental; | ||
| import io.temporal.serviceclient.WorkflowServiceStubs; | ||
| import io.temporal.workflow.NexusOperationOptions; |
There was a problem hiding this comment.
We should not be reusing the workflow NexusOperationOptions here, nothing in workflow should really be mentioned outside that package. See how stand alone activities redefined StartActivityOptions
| * proto requests and delegates the actual gRPC calls to {@link GenericWorkflowClient}. | ||
| */ | ||
| @Experimental | ||
| public class RootNexusClientInvoker implements NexusClientCallsInterceptor { |
There was a problem hiding this comment.
I believe you are missing Identity here, it should be set on most requests.
| @Nonnull DescribeNexusOperationExecutionRequest request, @Nonnull Deadline deadline); | ||
|
|
||
| // ---- Standalone Activity RPCs ---- | ||
| CompletableFuture<DescribeNexusOperationExecutionResponse> describeNexusOperationExecutionAsync( |
There was a problem hiding this comment.
I think we can remove describeNexusOperationExecutionAsync we should only have APIs here that are actually used by the high level clients/handles
|
Reviewed most of the public API, didn't get to into the tests or implementation for now since some stuff will likely change. |
What was changed
Why?
Checklist
Closes
How was this tested: