Skip to content

Signal links#2889

Open
Evanthx wants to merge 19 commits into
masterfrom
signal-links
Open

Signal links#2889
Evanthx wants to merge 19 commits into
masterfrom
signal-links

Conversation

@Evanthx
Copy link
Copy Markdown
Contributor

@Evanthx Evanthx commented May 26, 2026

Sending signals through Nexus now populates a link from the sender to the receiver as well as one from the receiver back to the sender.

What was changed

Why?

Checklist

  1. Closes

  2. How was this tested:

  1. Any docs updates needed?

@Evanthx Evanthx requested a review from a team as a code owner May 26, 2026 21:00
Comment thread temporal-sdk/src/main/java/io/temporal/internal/nexus/NexusTaskHandlerImpl.java Outdated
Comment thread temporal-sdk/src/main/java/io/temporal/internal/common/LinkConverter.java Outdated
Comment thread temporal-sdk/src/main/java/io/temporal/internal/nexus/NexusTaskHandlerImpl.java Outdated
Comment thread temporal-sdk/src/test/java/io/temporal/internal/common/InternalUtilsTest.java Outdated
@Evanthx Evanthx requested a review from Quinn-With-Two-Ns June 3, 2026 22:40
handle.getInvoker().invoke(nexusRequest);
WorkflowExecution workflowExec = nexusStartWorkflowResponse.getWorkflowExecution();

// If the start workflow response returned a link use it, otherwise
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did all this logic move?

private final List<Link> responseBacklinks = new ArrayList<>();
// Captured at construction (on the Nexus task executor's thread) and used to fail fast on any
// cross-thread mutation. See note on responseBacklinks.
private final Thread ownerThread;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think this is needed anymore?

.setCallbackUrl(task.getCallback())
.setRequestId(task.getRequestId());
task.getCallbackHeaderMap().forEach(operationStartDetails::putCallbackHeader);
// Stash the inbound links in common.v1.Link form on the operation context so that signal
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: We are stashing the links so that RPC's like signal can use them. More future proof IMO

if (commonLink != null) {
inboundCommonLinks.add(commonLink);
} else {
log.warn(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I would remove "signal propagation" here to account for more use cases

}
startResponseBuilder.setFailure(dataConverter.exceptionToFailure(temporalFailure));
} catch (Throwable failure) {
convertKnownFailures(failure);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we need to add this? Not saying it is wrong, just curious?

}

/**
* Backlinks from every outbound RPC the handler issued. Never null; may be empty. Returned as an
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Backlinks from every outbound RPC the handler issued. Never null; may be empty. Returned as an
* Backlinks from every outbound RPC the handler issued. Returned as an

Annotate with @Nonnull

public Link getStartWorkflowResponseLink() {
return startWorkflowResponseLink;
/** Links from the inbound Nexus task; empty if none. Never null. */
public List<Link> getNexusOperationLinks() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return startWorkflowResponseLink;
/** Links from the inbound Nexus task; empty if none. Never null. */
public List<Link> getNexusOperationLinks() {
return nexusOperationLinks;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is getBacklinks wrapped in unmodifiableList and this one not? Are they used differently?

try {
OperationStartResult<HandlerResultContent> result =
startOperation(context, operationStartDetails.build(), input.build());
// If signal or signalWithStart RPCs the handler issued returned backlinks, propagate them
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment is wrong, getBacklinks is also set by start workflow, I left this comment a few other places, but I would review all all the code comments and make sure they aren't being specific to signal since the code isn't now and will only get more general as we add more Nexus features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants