Skip to content

Add sample for stand alone nexus operations#456

Draft
Quinn-With-Two-Ns wants to merge 4 commits into
temporalio:mainfrom
Quinn-With-Two-Ns:stand-alone-nexus-operations
Draft

Add sample for stand alone nexus operations#456
Quinn-With-Two-Ns wants to merge 4 commits into
temporalio:mainfrom
Quinn-With-Two-Ns:stand-alone-nexus-operations

Conversation

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

Sample for stand alone nexus operations

Comment thread nexus-standalone-operations/handler_test.go Outdated
Comment thread nexus-standalone-operations/handler_test.go Outdated
Comment thread nexus-standalone-operations/handler_test.go Outdated
Comment thread nexus-standalone-operations/handler_test.go Outdated
Comment thread nexus-standalone-operations/handler_test.go Outdated
require.Eventually(t, func() bool {
var execErr error
handle, execErr = nexusClient.ExecuteOperation(ctx, opName, input, options)
return execErr == nil
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we should fix the need to retry for tests before we launch SANO. It's going to be annoying to use.
You should also only filter out not found errors here.

Copy link
Copy Markdown
Contributor

@Evanthx Evanthx left a comment

Choose a reason for hiding this comment

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

Asking some questions, not sure how many are just me being new still!

Comment thread go.mod Outdated

replace github.com/cactus/go-statsd-client => github.com/cactus/go-statsd-client/v5 v5.0.0

replace go.temporal.io/sdk => /Users/quinnklassen/Documents/Code/sdk-go
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 know you said this wasn't ready for checkin, but figured it was worth pointing out these two replace commands!

Comment thread nexus-standalone-operations/README.md Outdated
Comment thread nexus-standalone-operations/README.md Outdated
Comment thread nexus-standalone-operations/README.md Outdated
Comment thread nexus-standalone-operations/README.md Outdated

func main() {
// The client is a heavyweight object that should be created once per process.
c, err := client.Dial(envconfig.MustLoadDefaultClientOptions())
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.

The other Nexus samples are using "options.ParseClientOptionFlags(os.Args[1:])" before client.Dial, should this as well for consistent behavior?

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.

Yeah bit on the fence about this since the ParseClientOptionFlags(os.Args[1:]) was only added because we didn't have envconfig now that we do we should probably just lean on the since very other sample uses it. For consistency we should probably remove ParseClientOptionFlags from other samples and just lean on envconfig

Comment thread nexus-standalone-operations/worker/main.go

// Create a NexusClient bound to the endpoint and service.
// The endpoint must be pre-created on the server (see README).
nexusClient, err := c.NewNexusClient(client.NexusClientOptions{
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.

This is an odd one when looking at other Nexus sample code in here. I went to the equivalent spot and there is no NewNexusClient, so I thought maybe that's new? But then I found it in workflows.go at the top level, which isn't in this sample.

Short version - I am reading the code to see what is different, and so get thrown off - and mostly I was reading this to learn how to use Nexus for standalone operations, and I can't tell what makes this standalone as opposed to self hosted!

Copy link
Copy Markdown
Contributor Author

@Quinn-With-Two-Ns Quinn-With-Two-Ns Apr 13, 2026

Choose a reason for hiding this comment

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

Other Nexus samples starter code is starting a workflow not a Nexus operation, the comparison isn't between standalone and self hosted, the comparison is between inside a workflow and outside a workflow

}
log.Println("Hello result:", helloResult.Message)

// List Nexus operations using the base client (not NexusClient).
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 am pretty sure this is just me being new to Nexus still but -- does the reader know what you are talking about here? Why are there two clients? Why would I use the base client? Base implies that the NexusClient has it as a base class, but clearly that's not the case!

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.

Base implies that the NexusClient has it as a base class

Go has no concept of classes or base class so I don't think that is a conclusion a Go developer would reach, that being said I welcome any suggestions to make the wording hear clearer.

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.

I decided to use actual types instead of just "base"

@chrsmith
Copy link
Copy Markdown

I'll take care of rebasing and cleaning this up while Quinn is OOO.

@Quinn-With-Two-Ns Quinn-With-Two-Ns force-pushed the stand-alone-nexus-operations branch from e73488f to 05d4736 Compare May 21, 2026 16:18
Copy link
Copy Markdown
Contributor

@VegetarianOrc VegetarianOrc left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines +81 to +82
// executeWithRetry retries ExecuteOperation until the endpoint has propagated.
// The endpoint registry is eventually consistent.
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.

Would be good to have a link to an issue or some other way to track when we can remove this once the server side changes are in.

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.

5 participants