Skip to content

Commit 49574ac

Browse files
committed
address comments, change signatures to newer
1 parent 090d9d2 commit 49574ac

8 files changed

Lines changed: 411 additions & 175 deletions

File tree

temporal-sdk/src/main/java/io/temporal/internal/client/RootWorkflowClientInvoker.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,8 @@ private <R> UpdateWorkflowExecutionRequest toUpdateWorkflowExecutionRequest(
521521
.setIdentity(clientOptions.getIdentity()))
522522
.setInput(updateInput);
523523

524-
// If this update is being issued from inside a Nexus operation handler via
525-
// TemporalNexusClientImpl.startWorkflowUpdate, set the fields the server needs
526-
// to deliver the Nexus completion callback.
524+
// If this update is being issued via TemporalNexusClientImpl.startWorkflowUpdate,
525+
// set the fields the server needs to deliver the Nexus completion callback
527526
if (CurrentNexusOperationContext.isNexusContext()) {
528527
InternalNexusOperationContext nexusContext = CurrentNexusOperationContext.get();
529528
// already in a Nexus operation context, dont need to check nexusContext again
@@ -549,10 +548,9 @@ private <R> UpdateWorkflowExecutionRequest toUpdateWorkflowExecutionRequest(
549548
nexusOperationMetadata.operationToken,
550549
requestLinks))
551550
.addAllLinks(requestLinks);
552-
} else {
553-
log.error("unexpected error fetching nexusOperationMetadata");
554-
// maybe throw an exception but should never really happen as its all sdk
555551
}
552+
// If no NexusOperationMetadata was found, but there is a NexusContext, then the
553+
// update was likely trigger via Operation handler directly
556554
}
557555

558556
Request request = requestBuilder.build();

temporal-sdk/src/main/java/io/temporal/internal/common/LinkConverter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public static io.temporal.api.nexus.v1.Link workflowLinkToNexusLink(Link.Workflo
107107
.setUrl(url)
108108
.setType(workflowLinkType)
109109
.build();
110-
} catch (UnsupportedEncodingException e) {
110+
} catch (Exception e) {
111111
log.error("Failed to encode Nexus link URL", e);
112112
return null;
113113
}
@@ -190,6 +190,7 @@ public static Link nexusLinkToWorkflowLink(io.temporal.api.nexus.v1.Link nexusLi
190190
Link.Builder link = Link.newBuilder();
191191
try {
192192
URI uri = new URI(nexusLink.getUrl());
193+
log.debug("Parsing nexus link URL: {}", uri.getRawPath());
193194
if (!uri.getScheme().equals(temporalUrlScheme)) {
194195
log.error("Failed to parse Nexus link URL: invalid scheme: {}", uri.getScheme());
195196
return null;
@@ -234,7 +235,6 @@ public static io.temporal.api.nexus.v1.Link linkToNexusLink(Link commonLink) {
234235
if (commonLink.hasNexusOperation()) {
235236
return nexusOperationToNexusLink(commonLink.getNexusOperation());
236237
}
237-
// check for workflow link only if a more specific variant is not set
238238
if (commonLink.hasWorkflow()) {
239239
return workflowLinkToNexusLink(commonLink.getWorkflow());
240240
}

temporal-sdk/src/main/java/io/temporal/nexus/CancelUpdateWorkflowExecutionInput.java renamed to temporal-sdk/src/main/java/io/temporal/nexus/CancelUpdateWorkflowInput.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
package io.temporal.nexus;
22

3+
import com.google.common.base.Strings;
34
import io.temporal.common.Experimental;
45
import java.util.Objects;
5-
import javax.annotation.Nullable;
66

77
/**
88
* Input to {@link TemporalOperationHandler#cancelUpdateWorkflow} describing the workflow update to
99
* cancel.
1010
*/
1111
@Experimental
12-
public final class CancelUpdateWorkflowExecutionInput {
12+
public final class CancelUpdateWorkflowInput {
1313

1414
private final String workflowId;
15-
@Nullable private final String runId;
15+
private final String runId;
1616
private final String updateId;
1717

18-
public CancelUpdateWorkflowExecutionInput(
19-
String workflowId, @Nullable String runId, String updateId) {
18+
public CancelUpdateWorkflowInput(String workflowId, String runId, String updateId) {
2019
this.workflowId = Objects.requireNonNull(workflowId);
21-
this.runId = runId;
20+
this.runId = Strings.nullToEmpty(runId);
2221
this.updateId = Objects.requireNonNull(updateId);
2322
}
2423

@@ -27,8 +26,7 @@ public String getWorkflowId() {
2726
return workflowId;
2827
}
2928

30-
/** Returns the run ID extracted from the operation token, or null if not present. */
31-
@Nullable
29+
/** Returns the run ID extracted from the operation token, or empty if not present. */
3230
public String getRunId() {
3331
return runId;
3432
}

0 commit comments

Comments
 (0)