Skip to content

Sample code for Nexus messaging#290

Open
Evanthx wants to merge 9 commits intomainfrom
signals-nexus-python
Open

Sample code for Nexus messaging#290
Evanthx wants to merge 9 commits intomainfrom
signals-nexus-python

Conversation

@Evanthx
Copy link
Copy Markdown

@Evanthx Evanthx commented Apr 15, 2026

This is sample code to show two ways to send messages (signals, queries, and updates) through Nexus.

@Evanthx Evanthx requested a review from a team as a code owner April 15, 2026 18:31
@Evanthx Evanthx force-pushed the signals-nexus-python branch from d11d1a0 to 83386cf Compare April 15, 2026 22:57
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.

Code looks okay to me! A few comments throughout.

Left a couple of comments to help me understand the motivation for the structure of the samples as well.

Would like to clear up the intention around removing the sync operation sample before approving.

Comment thread nexus_messaging/callerpattern/caller/workflows.py Outdated
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.

Was this same intentionally deleted? I don't think we should remove the basic sync operation example in favor of a messaging sample.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

So this was the original base that I used as a starting point as it had messaging - everything that was in it is now in the new sample. I just moved the package name to be consistent with what I was doing elsewhere.

You have a point about basic sync operations - but this already had messaging in it so it was already not a basic sync example? So I think this is OK, but I can also see it being debatable, so leaving this comment unresolved so you can reply.

Copy link
Copy Markdown
Contributor

@VegetarianOrc VegetarianOrc Apr 21, 2026

Choose a reason for hiding this comment

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

As long as we update the related doc about this to reference this new sample, I think it's probably fine given the context!

In fact, we probably should take a pass on those docs for each lang as these samples get merged in to ensure they reflect the new sample, links are valid, etc.

Comment thread nexus_messaging/callerpattern/handler/workflows.py Outdated
Comment thread nexus_messaging/callerpattern/README.md
Comment on lines +12 to +16
The caller workflow:
1. Queries for supported languages (`get_languages` -- backed by a `@workflow.query`)
2. Changes the language to Arabic (`set_language` -- backed by a `@workflow.update` that calls an activity)
3. Confirms the change via a second query (`get_language`)
4. Approves the workflow (`approve` -- backed by a `@workflow.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: The caller workflow only executes nexus operations and it feels a bit confusing to call out that they're backed by workflow.query/update/signal. IMO that info should be called out about or alongside the service handler.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Since this is demonstrating queries, updates and signals this does actually feel useful to me though

Comment thread nexus_messaging/callerpattern/handler/worker.py
Comment thread nexus_messaging/callerpattern/handler/service_handler.py
Comment thread nexus_messaging/ondemandpattern/README.md
@Evanthx Evanthx requested a review from VegetarianOrc April 21, 2026 16:51
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