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); - } } ///