Skip to content

Sample code for Nexus messaging#776

Open
Evanthx wants to merge 10 commits intomainfrom
signals-nexus-java
Open

Sample code for Nexus messaging#776
Evanthx wants to merge 10 commits intomainfrom
signals-nexus-java

Conversation

@Evanthx
Copy link
Copy Markdown
Contributor

@Evanthx Evanthx commented Apr 8, 2026

This shows two ways to send messages through Nexus.

@Evanthx Evanthx requested review from a team, antmendoza and tsurdilo as code owners April 8, 2026 21:53
public interface NexusRemoteGreetingService {

class RunFromRemoteInput {
private final String workflowId;
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.

So part of the reason to wrap a Workflow in a Nexus service is to hide the workflow from the caller, so I wouldn't call this ID workflowId the service doesn't need to expose that it using workflows to the caller.

public class CallerStarter {

public static void main(String[] args) {
WorkflowServiceStubs service = WorkflowServiceStubs.newLocalServiceStubs();
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.

All samples should support env config. You can look at other samples to see how to create the client and follow the pattern there https://github.com/temporalio/samples-java/blob/main/core/src/main/java/io/temporal/samples/asyncchild/Starter.java#L22

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you as I didn't know about this - but these seem to be all non-nexus examples? I looked in the other Nexus samples and they aren't using the env files - but they are passing the namespace in on the commandline instead of in code. In code seems clearer to me, but I can switch to commandline arguments if desired.

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.

So a bit of background, the reason why all the other samples and the other Nexus samples have this customization point is so users can easily run the samples against a local server and Temporal Cloud. The other Nexus samples simply predate the environment config approach, for this new samples lets use environment config approach since it is the standard.

@Quinn-With-Two-Ns
Copy link
Copy Markdown
Contributor

Java code looks good, Can you share this with the SDK team and the rest of the Nexus team?

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.

2 participants