From 9c57671b7826a55ef00fd52203300129042d1dcc Mon Sep 17 00:00:00 2001 From: Chad Retz Date: Tue, 30 Sep 2025 08:19:55 -0500 Subject: [PATCH] Minor fix for worker validation --- src/Temporalio/Worker/TemporalWorker.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Temporalio/Worker/TemporalWorker.cs b/src/Temporalio/Worker/TemporalWorker.cs index 9bd1b5b1..78f9d85c 100644 --- a/src/Temporalio/Worker/TemporalWorker.cs +++ b/src/Temporalio/Worker/TemporalWorker.cs @@ -51,9 +51,9 @@ public TemporalWorker(IWorkerClient client, TemporalWorkerOptions options) client.Options.Namespace, options, loggerFactory); - if (options.Activities.Count == 0 && options.Workflows.Count == 0) + if (options.Activities.Count == 0 && options.Workflows.Count == 0 && options.NexusServices.Count == 0) { - throw new ArgumentException("Must have at least one workflow and/or activity"); + throw new ArgumentException("Must have at least one workflow, activity, and/or Nexus service"); } MetricMeter = MetricMeterBridge.LazyFromRuntime(BridgeWorker.Runtime); @@ -110,6 +110,11 @@ public TemporalWorker(IWorkerClient client, TemporalWorkerOptions options) DeploymentOptions: options.DeploymentOptions)); } + if (options.NexusServices.Count > 0) + { + nexusWorker = new(this); + } + disposer = new Disposer(activityWorker, BridgeWorker, workflowTracingEventListenerEnabled); } catch (Exception) @@ -122,10 +127,6 @@ public TemporalWorker(IWorkerClient client, TemporalWorkerOptions options) } throw; } - if (options.NexusServices.Count > 0) - { - nexusWorker = new(this); - } } ///