-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathWorkerV1Dot1.cs
More file actions
31 lines (27 loc) · 1.07 KB
/
WorkerV1Dot1.cs
File metadata and controls
31 lines (27 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using Temporalio.Client;
using Temporalio.Common;
using Temporalio.Worker;
namespace TemporalioSamples.WorkerVersioning;
public static class WorkerV1Dot1
{
public static async Task RunAsync(ITemporalClient client, CancellationToken cancellationToken = default)
{
var deploymentVersion = new WorkerDeploymentVersion(Program.DeploymentName, "1.1");
using var worker = new TemporalWorker(
client,
new TemporalWorkerOptions(Program.TaskQueue)
{
DeploymentOptions = new WorkerDeploymentOptions
{
Version = deploymentVersion,
UseWorkerVersioning = true,
DefaultVersioningBehavior = VersioningBehavior.AutoUpgrade,
},
}
.AddWorkflow<AutoUpgradingWorkflowV1Dot1>()
.AddWorkflow<PinnedWorkflowV1>()
.AddAllActivities(new MyActivities()));
Console.WriteLine($"Starting worker with version: {deploymentVersion}");
await worker.ExecuteAsync(cancellationToken);
}
}