diff --git a/temporal-sdk/src/main/java/io/temporal/activity/LocalActivityOptions.java b/temporal-sdk/src/main/java/io/temporal/activity/LocalActivityOptions.java index 031083747..8f66ec862 100644 --- a/temporal-sdk/src/main/java/io/temporal/activity/LocalActivityOptions.java +++ b/temporal-sdk/src/main/java/io/temporal/activity/LocalActivityOptions.java @@ -21,6 +21,7 @@ package io.temporal.activity; import com.google.common.base.Objects; +import io.temporal.common.Experimental; import io.temporal.common.MethodRetry; import io.temporal.common.RetryOptions; import java.time.Duration; @@ -56,6 +57,7 @@ public static final class Builder { private Duration localRetryThreshold; private RetryOptions retryOptions; private Boolean doNotIncludeArgumentsIntoMarker; + private String summary; /** Copy Builder fields from the options. */ private Builder(LocalActivityOptions options) { @@ -68,6 +70,7 @@ private Builder(LocalActivityOptions options) { this.localRetryThreshold = options.getLocalRetryThreshold(); this.retryOptions = options.getRetryOptions(); this.doNotIncludeArgumentsIntoMarker = options.isDoNotIncludeArgumentsIntoMarker(); + this.summary = options.getSummary(); } /** @@ -178,6 +181,18 @@ public Builder setDoNotIncludeArgumentsIntoMarker(boolean doNotIncludeArgumentsI return this; } + /** + * Single-line fixed summary for this activity that will appear in UI/CLI. This can be in + * single-line Temporal Markdown format. + * + *
Default is none/empty.
+ */
+ @Experimental
+ public Builder setSummary(String summary) {
+ this.summary = summary;
+ return this;
+ }
+
public Builder mergeActivityOptions(LocalActivityOptions override) {
if (override == null) {
return this;
@@ -204,6 +219,7 @@ public Builder mergeActivityOptions(LocalActivityOptions override) {
(override.doNotIncludeArgumentsIntoMarker != null)
? override.doNotIncludeArgumentsIntoMarker
: this.doNotIncludeArgumentsIntoMarker;
+ this.summary = (override.summary == null) ? this.summary : override.summary;
return this;
}
@@ -214,7 +230,8 @@ public LocalActivityOptions build() {
scheduleToStartTimeout,
localRetryThreshold,
retryOptions,
- doNotIncludeArgumentsIntoMarker);
+ doNotIncludeArgumentsIntoMarker,
+ summary);
}
public LocalActivityOptions validateAndBuildWithDefaults() {
@@ -228,7 +245,8 @@ public LocalActivityOptions validateAndBuildWithDefaults() {
scheduleToStartTimeout,
localRetryThreshold,
RetryOptions.newBuilder(retryOptions).validateBuildWithDefaults(),
- doNotIncludeArgumentsIntoMarker);
+ doNotIncludeArgumentsIntoMarker,
+ summary);
}
}
@@ -238,6 +256,7 @@ public LocalActivityOptions validateAndBuildWithDefaults() {
private final Duration scheduleToStartTimeout;
private final RetryOptions retryOptions;
private final Boolean doNotIncludeArgumentsIntoMarker;
+ private final String summary;
private LocalActivityOptions(
Duration startToCloseTimeout,
@@ -245,13 +264,15 @@ private LocalActivityOptions(
Duration scheduleToStartTimeout,
Duration localRetryThreshold,
RetryOptions retryOptions,
- Boolean doNotIncludeArgumentsIntoMarker) {
+ Boolean doNotIncludeArgumentsIntoMarker,
+ String summary) {
this.scheduleToCloseTimeout = scheduleToCloseTimeout;
this.startToCloseTimeout = startToCloseTimeout;
this.scheduleToStartTimeout = scheduleToStartTimeout;
this.localRetryThreshold = localRetryThreshold;
this.retryOptions = retryOptions;
this.doNotIncludeArgumentsIntoMarker = doNotIncludeArgumentsIntoMarker;
+ this.summary = summary;
}
public Duration getScheduleToCloseTimeout() {
@@ -278,6 +299,11 @@ public boolean isDoNotIncludeArgumentsIntoMarker() {
return doNotIncludeArgumentsIntoMarker != null && doNotIncludeArgumentsIntoMarker;
}
+ @Experimental
+ public String getSummary() {
+ return summary;
+ }
+
public Builder toBuilder() {
return new Builder(this);
}
@@ -292,7 +318,8 @@ public boolean equals(Object o) {
&& Objects.equal(startToCloseTimeout, that.startToCloseTimeout)
&& Objects.equal(scheduleToStartTimeout, that.scheduleToStartTimeout)
&& Objects.equal(localRetryThreshold, that.localRetryThreshold)
- && Objects.equal(retryOptions, that.retryOptions);
+ && Objects.equal(retryOptions, that.retryOptions)
+ && Objects.equal(summary, that.summary);
}
@Override
@@ -303,7 +330,8 @@ public int hashCode() {
scheduleToStartTimeout,
localRetryThreshold,
retryOptions,
- doNotIncludeArgumentsIntoMarker);
+ doNotIncludeArgumentsIntoMarker,
+ summary);
}
@Override
@@ -319,6 +347,8 @@ public String toString() {
+ retryOptions
+ ", doNotIncludeArgumentsIntoMarker="
+ isDoNotIncludeArgumentsIntoMarker()
+ + ", summary="
+ + summary
+ '}';
}
}
diff --git a/temporal-sdk/src/main/java/io/temporal/internal/statemachines/ExecuteLocalActivityParameters.java b/temporal-sdk/src/main/java/io/temporal/internal/statemachines/ExecuteLocalActivityParameters.java
index ab767ff40..232661052 100644
--- a/temporal-sdk/src/main/java/io/temporal/internal/statemachines/ExecuteLocalActivityParameters.java
+++ b/temporal-sdk/src/main/java/io/temporal/internal/statemachines/ExecuteLocalActivityParameters.java
@@ -23,6 +23,7 @@
import io.temporal.api.common.v1.ActivityType;
import io.temporal.api.common.v1.Payloads;
import io.temporal.api.failure.v1.Failure;
+import io.temporal.api.sdk.v1.UserMetadata;
import io.temporal.api.workflowservice.v1.PollActivityTaskQueueResponse;
import io.temporal.internal.common.ProtobufTimeUtils;
import io.temporal.workflow.Functions;
@@ -51,6 +52,7 @@ public class ExecuteLocalActivityParameters {
private final boolean doNotIncludeArgumentsIntoMarker;
private final @Nullable Duration scheduleToStartTimeout;
private @Nullable Functions.Proc onNewAttemptCallback;
+ private final UserMetadata metadata;
public ExecuteLocalActivityParameters(
@Nonnull PollActivityTaskQueueResponse.Builder activityTaskBuilder,
@@ -58,7 +60,8 @@ public ExecuteLocalActivityParameters(
long originalScheduledTimestamp,
@Nullable Failure previousLocalExecutionFailure,
boolean doNotIncludeArgumentsIntoMarker,
- @Nonnull Duration localRetryThreshold) {
+ @Nonnull Duration localRetryThreshold,
+ UserMetadata metadata) {
this.activityTaskBuilder = Objects.requireNonNull(activityTaskBuilder, "activityTaskBuilder");
this.scheduleToStartTimeout = scheduleToStartTimeout;
this.originalScheduledTimestamp = originalScheduledTimestamp;
@@ -66,6 +69,7 @@ public ExecuteLocalActivityParameters(
this.doNotIncludeArgumentsIntoMarker = doNotIncludeArgumentsIntoMarker;
this.localRetryThreshold = localRetryThreshold;
this.onNewAttemptCallback = null;
+ this.metadata = metadata;
}
public String getActivityId() {
@@ -136,4 +140,8 @@ public Functions.Proc getOnNewAttemptCallback() {
public void setOnNewAttemptCallback(@Nonnull Functions.Proc onNewAttemptCallback) {
this.onNewAttemptCallback = onNewAttemptCallback;
}
+
+ public UserMetadata getMetadata() {
+ return metadata;
+ }
}
diff --git a/temporal-sdk/src/main/java/io/temporal/internal/statemachines/LocalActivityStateMachine.java b/temporal-sdk/src/main/java/io/temporal/internal/statemachines/LocalActivityStateMachine.java
index 4feb781bc..420966967 100644
--- a/temporal-sdk/src/main/java/io/temporal/internal/statemachines/LocalActivityStateMachine.java
+++ b/temporal-sdk/src/main/java/io/temporal/internal/statemachines/LocalActivityStateMachine.java
@@ -31,6 +31,7 @@
import io.temporal.api.failure.v1.CanceledFailureInfo;
import io.temporal.api.failure.v1.Failure;
import io.temporal.api.history.v1.MarkerRecordedEventAttributes;
+import io.temporal.api.sdk.v1.UserMetadata;
import io.temporal.api.workflowservice.v1.RespondActivityTaskCanceledRequest;
import io.temporal.api.workflowservice.v1.RespondActivityTaskCompletedRequest;
import io.temporal.common.converter.DefaultDataConverter;
@@ -63,6 +64,7 @@ final class LocalActivityStateMachine
private final LocalActivityCallback callback;
private ExecuteLocalActivityParameters localActivityParameters;
+ private @Nullable UserMetadata userMetadata;
private final Functions.Func