Skip to content

Commit

Permalink
Update Nexus SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
Quinn-With-Two-Ns committed Dec 6, 2024
1 parent d340ecd commit 9b48893
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ext {
// Platforms
grpcVersion = '1.54.1' // [1.38.0,) Needed for io.grpc.protobuf.services.HealthStatusManager
jacksonVersion = '2.14.2' // [2.9.0,)
nexusVersion = '0.3.0-alpha' // [0.1.0,)
nexusVersion = '0.3.0-alpha'
// we don't upgrade to 1.10.x because it requires kotlin 1.6. Users may use 1.10.x in their environments though.
micrometerVersion = project.hasProperty("edgeDepsTest") ? '1.13.6' : '1.9.9' // [1.0.0,)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@
package io.temporal.internal.common;

import com.google.common.base.Defaults;
import io.nexusrpc.Header;
import io.temporal.api.common.v1.Callback;
import io.temporal.api.enums.v1.TaskQueueKind;
import io.temporal.api.taskqueue.v1.TaskQueue;
import io.temporal.client.WorkflowOptions;
import io.temporal.client.WorkflowStub;
import io.temporal.internal.client.NexusStartWorkflowRequest;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -83,9 +84,16 @@ public static WorkflowStub createNexusBoundStub(
// Add the Nexus operation ID to the headers if it is not already present to support fabricating
// a NexusOperationStarted event if the completion is received before the response to a
// StartOperation request.
Map<String, String> headers = new HashMap<>(request.getCallbackHeaders());
if (!headers.containsKey("nexus-operation-id")) {
headers.put("nexus-operation-id", options.getWorkflowId());
Map<String, String> headers =
request.getCallbackHeaders().entrySet().stream()
.collect(
Collectors.toMap(
(k) -> k.getKey().toLowerCase(),
Map.Entry::getValue,
(a, b) -> a,
() -> new TreeMap<>(String.CASE_INSENSITIVE_ORDER)));
if (!headers.containsKey(Header.OPERATION_ID)) {
headers.put(Header.OPERATION_ID, options.getWorkflowId());
}
WorkflowOptions.Builder nexusWorkflowOptions =
WorkflowOptions.newBuilder(options)
Expand Down

0 comments on commit 9b48893

Please sign in to comment.