Skip to content

Commit 56c0e32

Browse files
committed
use dts
1 parent 3bea221 commit 56c0e32

File tree

3 files changed

+26
-11
lines changed

3 files changed

+26
-11
lines changed

samples/EventsSample/EventsSample.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
<ItemGroup>
1414
<!-- Using p2p references so we can show latest changes in samples. -->
15-
<ProjectReference Include="$(SrcRoot)Client/Grpc/Client.Grpc.csproj" />
16-
<ProjectReference Include="$(SrcRoot)Worker/Grpc/Worker.Grpc.csproj" />
15+
<ProjectReference Include="$(SrcRoot)Client/AzureManaged/Client.AzureManaged.csproj" />
16+
<ProjectReference Include="$(SrcRoot)Worker/AzureManaged/Worker.AzureManaged.csproj" />
1717

1818
<!-- Reference the source generator -->
1919
<ProjectReference Include="$(SrcRoot)Generators/Generators.csproj"

samples/EventsSample/Program.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,32 @@
66
using EventsSample;
77
using Microsoft.DurableTask;
88
using Microsoft.DurableTask.Client;
9+
using Microsoft.DurableTask.Client.AzureManaged;
910
using Microsoft.DurableTask.Worker;
11+
using Microsoft.DurableTask.Worker.AzureManaged;
12+
using Microsoft.Extensions.Configuration;
1013
using Microsoft.Extensions.DependencyInjection;
1114
using Microsoft.Extensions.Hosting;
1215

1316
HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
1417

15-
builder.Services.AddDurableTaskClient().UseGrpc();
16-
builder.Services.AddDurableTaskWorker()
17-
.AddTasks(tasks =>
18+
string schedulerConnectionString = builder.Configuration.GetValue<string>("DURABLE_TASK_SCHEDULER_CONNECTION_STRING")
19+
?? throw new InvalidOperationException("DURABLE_TASK_SCHEDULER_CONNECTION_STRING is not set.");
20+
21+
builder.Services.AddDurableTaskClient(clientBuilder => clientBuilder.UseDurableTaskScheduler(schedulerConnectionString));
22+
23+
builder.Services.AddDurableTaskWorker(workerBuilder =>
24+
{
25+
workerBuilder.AddTasks(tasks =>
1826
{
1927
tasks.AddOrchestrator<ApprovalOrchestrator>();
2028
tasks.AddActivity<NotifyApprovalRequiredActivity>();
2129
tasks.AddOrchestrator<DataProcessingOrchestrator>();
2230
tasks.AddActivity<ProcessDataActivity>();
23-
})
24-
.UseGrpc();
31+
});
32+
33+
workerBuilder.UseDurableTaskScheduler(schedulerConnectionString);
34+
});
2535

2636
IHost host = builder.Build();
2737
await host.StartAsync();

samples/EventsSample/README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,16 @@ await client.RaiseEventAsync(
6363

6464
## Running the Sample
6565

66-
1. Ensure you have the Durable Task sidecar running (if using gRPC mode)
66+
This sample is configured to use **Durable Task Scheduler (DTS)** (no local gRPC sidecar required).
67+
68+
1. Set the DTS connection string:
69+
```bash
70+
export DURABLE_TASK_SCHEDULER_CONNECTION_STRING="..."
71+
```
6772
2. Run the sample:
68-
```bash
69-
dotnet run
70-
```
73+
```bash
74+
dotnet run
75+
```
7176

7277
The sample will:
7378
1. Start an approval workflow and wait for an approval event

0 commit comments

Comments
 (0)