• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

temporalio / sdk-java / #349

03 Aug 2026 05:42AM UTC coverage: 68.221% (+0.08%) from 68.143%
#349

push

github

web-flow
Add Standalone Activities to Temporal Nexus Operation Handler (#2918)

* Enable Nexus activity operations without regressing workflow updates

Compose standalone activity support with the workflow-update Nexus model already present on master. Shared token, callback, link, client, and cancellation paths retain both operation families.

Constraint: Preserve the workflow-update token and API contracts from master
Rejected: Choose one conflict side | each side would drop a supported Nexus operation family
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep activity execution at token type 2 and workflow update at token type 3
Tested: Focused temporal-sdk token, link, invoker, client, async activity, and cancellation tests
Not-tested: Full repository suite and real-server-only standalone activity cases

* Make sure we test attaching

* Make sure to handle ActivityAlreadyStartedException

* Add test with SANO

* Bump test server

7220 of 12610 branches covered (57.26%)

Branch coverage included in aggregate %.

182 of 283 new or added lines in 15 files covered. (64.31%)

13 existing lines in 3 files now uncovered.

29918 of 41828 relevant lines covered (71.53%)

0.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.56
/temporal-sdk/src/main/java/io/temporal/internal/nexus/OperationToken.java
1
package io.temporal.internal.nexus;
2

3
import com.fasterxml.jackson.annotation.JsonCreator;
4
import com.fasterxml.jackson.annotation.JsonInclude;
5
import com.fasterxml.jackson.annotation.JsonProperty;
6

7
/** Deserialized representation of a Nexus operation token. */
8
public class OperationToken {
9
  @JsonProperty("v")
10
  @JsonInclude(JsonInclude.Include.NON_NULL)
11
  private final Integer version;
12

13
  @JsonProperty("t")
14
  private final OperationTokenType type;
15

16
  @JsonProperty("ns")
17
  private final String namespace;
18

19
  @JsonProperty("wid")
20
  @JsonInclude(JsonInclude.Include.NON_NULL)
21
  private final String workflowId;
22

23
  @JsonProperty("aid")
24
  @JsonInclude(JsonInclude.Include.NON_NULL)
25
  private final String activityId;
26

27
  @JsonProperty("rid")
28
  @JsonInclude(JsonInclude.Include.NON_NULL)
29
  private final String runId;
30

31
  @JsonProperty("uid")
32
  @JsonInclude(JsonInclude.Include.NON_NULL)
33
  private final String updateId;
34

35
  @JsonCreator
36
  public OperationToken(
37
      @JsonProperty("t") Integer type,
38
      @JsonProperty("ns") String namespace,
39
      @JsonProperty("wid") String workflowId,
40
      @JsonProperty("aid") String activityId,
41
      @JsonProperty("rid") String runId,
42
      @JsonProperty("uid") String updateId,
43
      @JsonProperty("v") Integer version) {
1✔
44
    this.type = OperationTokenType.fromValue(type);
1✔
45
    this.namespace = namespace;
1✔
46
    this.workflowId = workflowId;
1✔
47
    this.activityId = activityId;
1✔
48
    this.runId = runId;
1✔
49
    this.updateId = updateId;
1✔
50
    this.version = version;
1✔
51
  }
1✔
52

53
  /** Generate a token for a workflow run operation */
54
  public OperationToken(OperationTokenType type, String namespace, String workflowId) {
1✔
55
    this.type = type;
1✔
56
    this.namespace = namespace;
1✔
57
    this.workflowId = workflowId;
1✔
58
    this.activityId = null;
1✔
59
    this.runId = null;
1✔
60
    this.updateId = null;
1✔
61
    this.version = null;
1✔
62
  }
1✔
63

64
  public OperationToken(
65
      OperationTokenType type, String namespace, String workflowId, String activityId) {
NEW
66
    this(type, namespace, workflowId, activityId, null);
×
NEW
67
  }
×
68

69
  public OperationToken(
70
      OperationTokenType type,
71
      String namespace,
72
      String workflowId,
73
      String activityId,
74
      String runId) {
1✔
75
    this.type = type;
1✔
76
    this.namespace = namespace;
1✔
77
    this.workflowId = workflowId;
1✔
78
    this.activityId = activityId;
1✔
79
    this.runId = runId;
1✔
80
    this.updateId = null;
1✔
81
    this.version = null;
1✔
82
  }
1✔
83

84
  /** Generate a token for a workflow update operation */
85
  public OperationToken(String namespace, String workflowId, String runId, String updateId) {
1✔
86
    this.type = OperationTokenType.WORKFLOW_UPDATE;
1✔
87
    this.namespace = namespace;
1✔
88
    this.workflowId = workflowId;
1✔
89
    this.activityId = null;
1✔
90
    this.runId = runId;
1✔
91
    this.updateId = updateId;
1✔
92
    this.version = null;
1✔
93
  }
1✔
94

95
  public Integer getVersion() {
96
    return version;
1✔
97
  }
98

99
  public OperationTokenType getType() {
100
    return type;
1✔
101
  }
102

103
  public String getNamespace() {
104
    return namespace;
1✔
105
  }
106

107
  public String getWorkflowId() {
108
    return workflowId;
1✔
109
  }
110

111
  public String getUpdateId() {
112
    return updateId;
1✔
113
  }
114

115
  public String getActivityId() {
116
    return activityId;
1✔
117
  }
118

119
  /**
120
   * Returns the activity run ID embedded in the token, or {@code null} if absent.
121
   *
122
   * <p>For activity-execution tokens, the run ID is only present after the start RPC completes.
123
   * Workflow-update tokens may also carry a run ID.
124
   */
125
  public String getRunId() {
126
    return runId;
1✔
127
  }
128
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc