-
Notifications
You must be signed in to change notification settings - Fork 219
Add Standalone Activities to Temporal Nexus Operation Handler #2918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Quinn-With-Two-Ns
wants to merge
2
commits into
temporalio:master
Choose a base branch
from
Quinn-With-Two-Ns:NEXUS-383
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
temporal-sdk/src/main/java/io/temporal/internal/client/ActivityClientInternal.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package io.temporal.internal.client; | ||
|
|
||
| import io.temporal.common.interceptors.ActivityClientCallsInterceptor; | ||
|
|
||
| /** | ||
| * Internal-only view of an {@code ActivityClient} that exposes the configured interceptor chain. | ||
| * | ||
| * <p>Lives in {@code io.temporal.internal.client} so that other internal SDK packages (e.g. {@code | ||
| * io.temporal.nexus}) can route a fully-constructed {@link | ||
| * ActivityClientCallsInterceptor.StartActivityInput} through the chain without bypassing | ||
| * user-registered interceptors or the metrics-tagged scope, and without forcing the concrete impl | ||
| * class to be public. | ||
| */ | ||
| public interface ActivityClientInternal { | ||
| ActivityClientCallsInterceptor getInvoker(); | ||
| } |
82 changes: 82 additions & 0 deletions
82
temporal-sdk/src/main/java/io/temporal/internal/client/NexusStartActivityRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| package io.temporal.internal.client; | ||
|
|
||
| import io.nexusrpc.Link; | ||
| import io.temporal.client.StartActivityOptions; | ||
| import io.temporal.common.Experimental; | ||
| import io.temporal.common.interceptors.Header; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| /** | ||
| * Request used to start an activity from a Nexus operation handler. Mirrors {@link | ||
| * NexusStartWorkflowRequest} but carries the activity-specific scheduling payload. | ||
| */ | ||
| @Experimental | ||
| public final class NexusStartActivityRequest { | ||
| private final String requestId; | ||
| private final String callbackUrl; | ||
| private final Map<String, String> callbackHeaders; | ||
| private final String taskQueue; | ||
| private final List<Link> links; | ||
| private final String activityType; | ||
| private final List<Object> args; | ||
| private final StartActivityOptions options; | ||
| private final Header header; | ||
|
|
||
| public NexusStartActivityRequest( | ||
| String requestId, | ||
| String callbackUrl, | ||
| Map<String, String> callbackHeaders, | ||
| String taskQueue, | ||
| List<Link> links, | ||
| String activityType, | ||
| List<Object> args, | ||
| StartActivityOptions options, | ||
| Header header) { | ||
| this.requestId = requestId; | ||
| this.callbackUrl = callbackUrl; | ||
| this.callbackHeaders = callbackHeaders; | ||
| this.taskQueue = taskQueue; | ||
| this.links = links; | ||
| this.activityType = activityType; | ||
| this.args = args; | ||
| this.options = options; | ||
| this.header = header; | ||
| } | ||
|
|
||
| public String getRequestId() { | ||
| return requestId; | ||
| } | ||
|
|
||
| public String getCallbackUrl() { | ||
| return callbackUrl; | ||
| } | ||
|
|
||
| public Map<String, String> getCallbackHeaders() { | ||
| return callbackHeaders; | ||
| } | ||
|
|
||
| public String getTaskQueue() { | ||
| return taskQueue; | ||
| } | ||
|
|
||
| public List<Link> getLinks() { | ||
| return links; | ||
| } | ||
|
|
||
| public String getActivityType() { | ||
| return activityType; | ||
| } | ||
|
|
||
| public List<Object> getArgs() { | ||
| return args; | ||
| } | ||
|
|
||
| public StartActivityOptions getOptions() { | ||
| return options; | ||
| } | ||
|
|
||
| public Header getHeader() { | ||
| return header; | ||
| } | ||
| } |
35 changes: 35 additions & 0 deletions
35
temporal-sdk/src/main/java/io/temporal/internal/client/NexusStartActivityResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| package io.temporal.internal.client; | ||
|
|
||
| import io.temporal.common.Experimental; | ||
| import javax.annotation.Nullable; | ||
|
|
||
| /** | ||
| * Response returned from starting an activity via {@link NexusStartActivityRequest}. Mirrors {@link | ||
| * NexusStartWorkflowResponse}. | ||
| */ | ||
| @Experimental | ||
| public final class NexusStartActivityResponse { | ||
| private final String activityId; | ||
| private final @Nullable String runId; | ||
| private final String operationToken; | ||
|
|
||
| public NexusStartActivityResponse( | ||
| String activityId, @Nullable String runId, String operationToken) { | ||
| this.activityId = activityId; | ||
| this.runId = runId; | ||
| this.operationToken = operationToken; | ||
| } | ||
|
|
||
| public String getActivityId() { | ||
| return activityId; | ||
| } | ||
|
|
||
| @Nullable | ||
| public String getRunId() { | ||
| return runId; | ||
| } | ||
|
|
||
| public String getOperationToken() { | ||
| return operationToken; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to think if this is the right way to propogate this information