Skip to content

Commit 0db359d

Browse files
committed
Renamed methods to remove the word signal
1 parent 9c167bf commit 0db359d

3 files changed

Lines changed: 30 additions & 30 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public WorkflowSignalOutput signal(WorkflowSignalInput input) {
139139
// Server >=1.31 with EnableCHASMSignalBacklinks returns a backlink pointing at the signal
140140
// event; older servers leave it unset. Propagate when present.
141141
if (CurrentNexusOperationContext.isNexusContext() && response.hasLink()) {
142-
CurrentNexusOperationContext.get().addSignalWorkflowResponseLink(response.getLink());
142+
CurrentNexusOperationContext.get().addBacklink(response.getLink());
143143
}
144144
return new WorkflowSignalOutput();
145145
}
@@ -178,7 +178,7 @@ public WorkflowSignalWithStartOutput signalWithStart(WorkflowSignalWithStartInpu
178178
// Server >=1.31 with EnableCHASMSignalBacklinks returns a backlink pointing at the signal
179179
// event; older servers leave it unset. Propagate when present.
180180
if (CurrentNexusOperationContext.isNexusContext() && response.hasSignalLink()) {
181-
CurrentNexusOperationContext.get().addSignalWorkflowResponseLink(response.getSignalLink());
181+
CurrentNexusOperationContext.get().addBacklink(response.getSignalLink());
182182
}
183183
// TODO currently SignalWithStartWorkflowExecutionResponse doesn't have eagerWorkflowTask.
184184
// We should wire it when it's implemented server-side.

temporal-sdk/src/main/java/io/temporal/internal/nexus/InternalNexusOperationContext.java

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,16 @@ public class InternalNexusOperationContext {
2222
// workflow client (signal, signalWithStart) can attach them to outgoing requests via
2323
// SignalWorkflowExecutionRequest.links.
2424
private List<Link> nexusOperationLinks = Collections.emptyList();
25-
// Backlinks returned by SignalWorkflowExecutionResponse.link /
26-
// SignalWithStartWorkflowExecutionResponse.signal_link. One entry per signal RPC issued from
27-
// within the Nexus operation handler. Drained by the task handler when building
28-
// StartOperationResponse so every signal the handler issues gets a corresponding link on the
29-
// caller workflow's history event.
25+
// Backlinks returned by outbound RPCs the operation handler issues (currently
26+
// SignalWorkflowExecutionResponse.link and SignalWithStartWorkflowExecutionResponse.signal_link;
27+
// future update/start variants attach the same way). One entry per outbound RPC that returned
28+
// a link. Drained by the task handler when building StartOperationResponse so each RPC the
29+
// handler issued gets a corresponding link on the caller workflow's history event.
3030
//
3131
// NOTE: this context is only safe for use from the single thread that runs the operation
3232
// handler (the Nexus task executor's thread). Handlers that spawn their own threads to issue
33-
// signals will not see the thread-local context, so the links from those signals will not
34-
// propagate.
35-
private final List<Link> signalWorkflowResponseLinks = new ArrayList<>();
33+
// RPCs will not see the thread-local context, so the links from those RPCs will not propagate.
34+
private final List<Link> responseBacklinks = new ArrayList<>();
3635

3736
public InternalNexusOperationContext(
3837
String namespace,
@@ -88,7 +87,7 @@ public Link getStartWorkflowResponseLink() {
8887

8988
/**
9089
* Set the {@code common.v1.Link}s extracted from the inbound Nexus task so they can be attached
91-
* to any signal RPCs issued by the operation handler.
90+
* to RPCs issued by the operation handler.
9291
*/
9392
public void setNexusOperationLinks(List<Link> links) {
9493
this.nexusOperationLinks = links == null ? Collections.emptyList() : links;
@@ -100,19 +99,19 @@ public List<Link> getNexusOperationLinks() {
10099
}
101100

102101
/**
103-
* Append a backlink returned by a signal-class RPC (signal or signalWithStart). Each signal the
104-
* operation handler issues should add one entry; the task handler drains the list when building
105-
* the operation's StartOperationResponse.
102+
* Append a backlink returned by an outbound RPC the operation handler issued (e.g. signal,
103+
* signalWithStart, and future update/start variants). The task handler drains the list when
104+
* building the operation's StartOperationResponse.
106105
*/
107-
public void addSignalWorkflowResponseLink(Link link) {
106+
public void addBacklink(Link link) {
108107
if (link != null) {
109-
this.signalWorkflowResponseLinks.add(link);
108+
this.responseBacklinks.add(link);
110109
}
111110
}
112111

113-
/** Backlinks from every signal RPC issued by the handler. Never null; may be empty. */
114-
public List<Link> getSignalWorkflowResponseLinks() {
115-
return signalWorkflowResponseLinks;
112+
/** Backlinks from every outbound RPC the handler issued. Never null; may be empty. */
113+
public List<Link> getBacklinks() {
114+
return responseBacklinks;
116115
}
117116

118117
private class NexusOperationContextImpl implements NexusOperationContext {

temporal-sdk/src/main/java/io/temporal/internal/nexus/NexusTaskHandlerImpl.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -328,27 +328,28 @@ private StartOperationResponse handleStartOperation(
328328
try {
329329
OperationStartResult<HandlerResultContent> result =
330330
startOperation(context, operationStartDetails.build(), input.build());
331-
// If signal/signalWithStart RPCs issued by the handler returned backlinks, propagate
332-
// them to the caller so the caller workflow's history event links to each signal event
333-
// on the callee. Same set of backlinks applies to both sync and async response variants.
334-
List<io.temporal.api.nexus.v1.Link> signalBacklinks = new ArrayList<>();
335-
for (io.temporal.api.common.v1.Link signalResponseLink :
336-
CurrentNexusOperationContext.get().getSignalWorkflowResponseLinks()) {
337-
if (!signalResponseLink.hasWorkflowEvent()) {
331+
// If outbound RPCs the handler issued (signal, signalWithStart, future update/start
332+
// variants) returned backlinks, propagate them to the caller so the caller workflow's
333+
// history event links to each event on the callee. Same set of backlinks applies to both
334+
// sync and async response variants.
335+
List<io.temporal.api.nexus.v1.Link> backlinks = new ArrayList<>();
336+
for (io.temporal.api.common.v1.Link backlink :
337+
CurrentNexusOperationContext.get().getBacklinks()) {
338+
if (!backlink.hasWorkflowEvent()) {
338339
continue;
339340
}
340341
io.temporal.api.nexus.v1.Link converted =
341-
LinkConverter.workflowEventToNexusLink(signalResponseLink.getWorkflowEvent());
342+
LinkConverter.workflowEventToNexusLink(backlink.getWorkflowEvent());
342343
if (converted != null) {
343-
signalBacklinks.add(converted);
344+
backlinks.add(converted);
344345
}
345346
}
346347

347348
if (result.isSync()) {
348349
startResponseBuilder.setSyncSuccess(
349350
StartOperationResponse.Sync.newBuilder()
350351
.setPayload(Payload.parseFrom(result.getSyncResult().getDataBytes()))
351-
.addAllLinks(signalBacklinks)
352+
.addAllLinks(backlinks)
352353
.build());
353354
} else {
354355
startResponseBuilder.setAsyncSuccess(
@@ -364,7 +365,7 @@ private StartOperationResponse handleStartOperation(
364365
.setUrl(link.getUri().toString())
365366
.build())
366367
.collect(Collectors.toList()))
367-
.addAllLinks(signalBacklinks)
368+
.addAllLinks(backlinks)
368369
.build());
369370
}
370371
} catch (OperationException e) {

0 commit comments

Comments
 (0)