No Workflow is pre-started. The caller creates and controls Workflow instances through Nexus
operations. NexusRemoteGreetingService adds a run_from_remote operation that starts a new
GreetingWorkflow, and every other operation includes a user_id so the handler knows which
instance to target.
The caller Workflow:
- Starts two remote
GreetingWorkflowinstances viarun_from_remote(backed byworkflow_run_operation) - Queries each for supported languages
- Changes the language on each (Arabic and Hindi)
- Confirms the changes via queries
- Approves both Workflows
- Waits for each to complete and returns their results
Start a Temporal server:
temporal server start-devCreate the namespaces and Nexus endpoint:
temporal operator namespace create --namespace nexus-messaging-handler-namespace
temporal operator namespace create --namespace nexus-messaging-caller-namespace
temporal operator nexus endpoint create \
--name nexus-messaging-nexus-endpoint \
--target-namespace nexus-messaging-handler-namespace \
--target-task-queue nexus-messaging-handler-task-queueIn one terminal, start the handler worker:
uv run python -m nexus_messaging.ondemandpattern.handler.workerIn another terminal, run the following command to start the example:
uv run python -m nexus_messaging.ondemandpattern.caller.appExpected output:
started remote greeting workflow: UserId One
started remote greeting workflow: UserId Two
Supported languages for UserId One: [<Language.CHINESE: 2>, <Language.ENGLISH: 3>]
Supported languages for UserId Two: [<Language.CHINESE: 2>, <Language.ENGLISH: 3>]
UserId One changed language: ENGLISH -> ARABIC
UserId Two changed language: ENGLISH -> HINDI
Workflows approved
Workflow one result: مرحبا بالعالم
Workflow two result: नमस्ते दुनिया