💥 Standalone Activities for Java#2858
Merged
GregoryTravis merged 91 commits intomasterfrom Apr 30, 2026
Merged
Conversation
Remove isEmpty() check from isWorkflowActivity.
This reverts commit 381e66c.
mjameswh
reviewed
Apr 29, 2026
mjameswh
reviewed
Apr 29, 2026
mjameswh
reviewed
Apr 29, 2026
mjameswh
reviewed
Apr 29, 2026
mjameswh
reviewed
Apr 29, 2026
…edundant Impl implementations.
maciejdudko
requested changes
Apr 30, 2026
Contributor
maciejdudko
left a comment
There was a problem hiding this comment.
Looks good, but there are a couple things that need to be fixed before merging, most notably caching inside ActivityHandleImpl and how AsyncCompletionClient creates ManualActivityCompletionClient for standalone activities. See comments in code.
Implemented this by adding a Deadline to RootActivityClientInvoker.getActivityResult. Also: In tests, use .start(...).get() instead of .executeAsync, for clarity. Added stopwatch check to testGetActivityResultAsyncTimeoutAbortsPolling to avoid possibility of false negative.
…ToCloseTimeout are allowed.
…ceptors with real ActivityClient.
…cardsNonVoidResult. Renames: ActivityInfoStandaloneTest -> ActivityInfoImplTest, testDescribeNoToken -> testDescribe in ActivityHandleImplTest.
Finished with other reviewers.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add standalone activity API (ActivityClient)
Introduces support for standalone activities — activities that execute independently of any workflow.
💥 Breaking Changes:
ActivityInfo.getWorkflowId,.getRunId,.getWorkflowNamespacecan now return null, in the case of standalone activities.getRunIdnow deprecated in favor of.getWorkflowRunIdand.getActivityRunId.New public API surface:
ActivityClient— top-level client for starting, describing,listing, counting, cancelling, and terminating standalone activities
ActivityHandle<R>/UntypedActivityHandle— typed and untypedhandles returned by
ActivityClient.start(); providegetResult(),getResult(long, TimeUnit),getResultAsync(),describe(),cancel(), andterminate()StartActivityOptions— builder-based options for starting anactivity (id, task queue, timeouts, retry, priority, etc.)
ActivityClientOptions— namespace / data converter / interceptorconfiguration for
ActivityClientActivityExecutionDescription— rich descriptor returned bydescribe()andlist*(); extendsActivityExecutionMetadataActivityExecutionMetadata— lightweight metadata used in listresults
ActivityExecutionCount— result ofcountActivities()ActivityAlreadyStartedException— thrown when a duplicate activityid is rejected by the server
ActivityFailedException— thrown fromgetResult()when theactivity fails
New interceptor API:
ActivityClientCallsInterceptor— per-call interceptor for allActivityClientoperationsActivityClientCallsInterceptorBase— pass-through baseimplementation (delegates every method to the next interceptor)
ActivityClientInterceptor— factory interceptor that wraps theclient-level invoker
ActivityClientInterceptorBase— no-op base implementationActivityInfoadditions:getActivityRunId()— run-scoped id assigned by the server to eachactivity execution
isInWorkflow()— distinguishes workflow-dispatched activitiesfrom standalone ones
ActivityCompletionClientadditions:(String activityId, Optional<String> runId, …)for completing, failing, sending heartbeats, and cancelling standalone
activities without a workflow id
ActivitySerializationContextfix:workflowIdandworkflowTypeare now@Nullable; removedrequireNonNullguards that caused NPEs for standalone activitiesFunctions.java:FuncandVFunc(zero-arg typed/void functional interfaces)needed by
ActivityClient.start()method-reference overloadsCI:
dev server used by unit tests:
frontend.activityAPIsEnabled,activity.enableStandalone,history.enableChasm,history.enableTransitionHistoryTests:
StandaloneActivityTest— integration tests against a real servercovering the full activity lifecycle (start, poll, complete, cancel,
terminate, describe, list, heartbeat, async completion)
ActivityClientCallsInterceptorBaseTest— delegation tests for thebase interceptor
ActivityClientCallsInterceptorChainTest— chain ordering testsusing a real server with two interceptors
ActivityHandleImplTest— unit tests for handle dispatchActivityCompletionClientImplTest— unit tests for completion clientActivityInfoImplTest— unit tests forActivityInfoin thestandalone context
ActivitySerializationContextTest— confirms nullable workflow fieldsStartActivityOptionsTest,ActivityClientOptionsTest,ActivityExecutionDescriptionTest,ActivityExecutionMetadataTest,ActivityAlreadyStartedExceptionTest— options and value-type tests