Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
6723dde
Add remote activity SDK APIs
YunchuWang May 14, 2026
05223b6
Add remote activity worker profiles
YunchuWang May 14, 2026
ce8c38c
serverless pkg
YunchuWang May 15, 2026
8d96663
remove launchcommand
YunchuWang May 15, 2026
6dc7d23
separate declare from conneect
YunchuWang May 15, 2026
a94c91c
logcleanup
YunchuWang May 15, 2026
a1a03d8
use grpc retry
YunchuWang May 15, 2026
f58cd4d
inflight activity tracker
YunchuWang May 15, 2026
48f7284
serverless connection resilient
YunchuWang May 15, 2026
7c94c39
completeasync
YunchuWang May 15, 2026
cfa428e
add jitter
YunchuWang May 15, 2026
11a7914
dup headers
YunchuWang May 18, 2026
821069a
make taskhub metadata opt-out
YunchuWang May 20, 2026
1077961
Add serverless sandbox list and log APIs
YunchuWang May 20, 2026
e1433f2
remove declarat
YunchuWang May 20, 2026
4891155
Add serverless activities sample
YunchuWang May 20, 2026
42b6153
Remove serverless sample no-auth credential
YunchuWang May 20, 2026
71c9359
Simplify serverless sample auth and HTTP helper
YunchuWang May 20, 2026
55c9e36
Remove insecure credential sample wiring
YunchuWang May 20, 2026
560557c
simple serverless sample
YunchuWang May 21, 2026
2ca9681
Simplify serverless sample dashboard flow
YunchuWang May 21, 2026
dfede69
cleanup
YunchuWang May 21, 2026
81a603c
sync proto
YunchuWang May 21, 2026
18c8e02
remove env var
YunchuWang May 21, 2026
d5dcc19
Revert "remove env var"
YunchuWang May 22, 2026
408ee71
Enhance serverless worker registration and configuration
YunchuWang May 22, 2026
008a416
Remove serverless wakeup listener
YunchuWang May 22, 2026
a60e43a
Split serverless worker runtime options
YunchuWang May 22, 2026
ee477ac
Refactor serverless options and improve activity registration methods
YunchuWang May 22, 2026
098983a
remove public pull
YunchuWang May 22, 2026
44ee2e5
Enable annotation-based serverless declarations
YunchuWang May 27, 2026
7188bb8
Simplify serverless sample; move worker profile
YunchuWang May 27, 2026
5f431e3
Validate and resolve serverless activity annotations
YunchuWang May 27, 2026
46ce48b
Disallow EnableServerlessActivities in worker
YunchuWang May 27, 2026
dcbb904
Refactor serverless annotation resolution
YunchuWang May 27, 2026
862f5f2
Resolve and validate declared serverless activities
YunchuWang May 27, 2026
d907e31
Serverless: use appsettings and remove marker
YunchuWang May 27, 2026
f05c6b3
Inline task name resolver; remove helper class
YunchuWang May 27, 2026
cf26c58
Rename annotation resolver to declaration
YunchuWang May 27, 2026
d4373e6
Use attributes for serverless activity declarations
YunchuWang May 27, 2026
ae1f0d1
Use AddActivity for serverless declarations
YunchuWang May 28, 2026
b6faacd
Fail serverless worker without activities
YunchuWang May 28, 2026
d71f765
Harden serverless worker runtime defaults
YunchuWang May 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- Updated private preview serverless worker profile declarations to use `ServerlessOptions.AddActivity(...)`, and updated the serverless sample to share activity name constants between the main app and remote worker.

## v1.24.2
- Bump DI.Abstractions and Bcl.AsyncInterfaces to 9.0.1 ([#3433](https://github.com/microsoft/durabletask-dotnet/pull/3433)) (#723)
Expand Down
79 changes: 76 additions & 3 deletions Microsoft.DurableTask.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32901.215
Expand Down Expand Up @@ -115,6 +115,24 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NamespaceGenerationSample",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReplaySafeLoggerFactorySample", "samples\ReplaySafeLoggerFactorySample\ReplaySafeLoggerFactorySample.csproj", "{8E7BECBC-7226-4778-B8F2-8EBDFF0D3BA4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions", "{21303FBF-2A2B-17C2-D2DF-3E924022E940}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureManagedServerless", "src\Extensions\AzureManagedServerless\AzureManagedServerless.csproj", "{C6DC28DC-95CE-42DA-B02C-FFB2BA1CB1A2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AzureManaged", "AzureManaged", "{D4587EC0-1B16-8420-7502-A967139249D4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AzureManaged", "AzureManaged", "{53193780-CD18-2643-6953-C26F59EAEDF5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions", "{00205C88-F000-28F2-A910-C6FA00E065EE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AzureManagedServerless.Tests", "test\Extensions\AzureManagedServerless.Tests\AzureManagedServerless.Tests.csproj", "{4D50F5B2-4782-486F-A9AA-073D798CC60D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "serverless", "serverless", "{5BD6F026-413E-9AC5-D159-8E8D9F26EF1B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "main-app", "samples\serverless\main-app\main-app.csproj", "{4535F88F-EA1C-4C6F-84D5-93535EE1568C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "remote-worker", "samples\serverless\remote-worker\remote-worker.csproj", "{562E5DB9-761B-4DE9-98CB-C364F6DE558E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -701,7 +719,54 @@ Global
{8E7BECBC-7226-4778-B8F2-8EBDFF0D3BA4}.Release|x64.Build.0 = Release|Any CPU
{8E7BECBC-7226-4778-B8F2-8EBDFF0D3BA4}.Release|x86.ActiveCfg = Release|Any CPU
{8E7BECBC-7226-4778-B8F2-8EBDFF0D3BA4}.Release|x86.Build.0 = Release|Any CPU

{C6DC28DC-95CE-42DA-B02C-FFB2BA1CB1A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C6DC28DC-95CE-42DA-B02C-FFB2BA1CB1A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C6DC28DC-95CE-42DA-B02C-FFB2BA1CB1A2}.Debug|x64.ActiveCfg = Debug|Any CPU
{C6DC28DC-95CE-42DA-B02C-FFB2BA1CB1A2}.Debug|x64.Build.0 = Debug|Any CPU
{C6DC28DC-95CE-42DA-B02C-FFB2BA1CB1A2}.Debug|x86.ActiveCfg = Debug|Any CPU
{C6DC28DC-95CE-42DA-B02C-FFB2BA1CB1A2}.Debug|x86.Build.0 = Debug|Any CPU
{C6DC28DC-95CE-42DA-B02C-FFB2BA1CB1A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C6DC28DC-95CE-42DA-B02C-FFB2BA1CB1A2}.Release|Any CPU.Build.0 = Release|Any CPU
{C6DC28DC-95CE-42DA-B02C-FFB2BA1CB1A2}.Release|x64.ActiveCfg = Release|Any CPU
{C6DC28DC-95CE-42DA-B02C-FFB2BA1CB1A2}.Release|x64.Build.0 = Release|Any CPU
{C6DC28DC-95CE-42DA-B02C-FFB2BA1CB1A2}.Release|x86.ActiveCfg = Release|Any CPU
{C6DC28DC-95CE-42DA-B02C-FFB2BA1CB1A2}.Release|x86.Build.0 = Release|Any CPU
{4D50F5B2-4782-486F-A9AA-073D798CC60D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4D50F5B2-4782-486F-A9AA-073D798CC60D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D50F5B2-4782-486F-A9AA-073D798CC60D}.Debug|x64.ActiveCfg = Debug|Any CPU
{4D50F5B2-4782-486F-A9AA-073D798CC60D}.Debug|x64.Build.0 = Debug|Any CPU
{4D50F5B2-4782-486F-A9AA-073D798CC60D}.Debug|x86.ActiveCfg = Debug|Any CPU
{4D50F5B2-4782-486F-A9AA-073D798CC60D}.Debug|x86.Build.0 = Debug|Any CPU
{4D50F5B2-4782-486F-A9AA-073D798CC60D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D50F5B2-4782-486F-A9AA-073D798CC60D}.Release|Any CPU.Build.0 = Release|Any CPU
{4D50F5B2-4782-486F-A9AA-073D798CC60D}.Release|x64.ActiveCfg = Release|Any CPU
{4D50F5B2-4782-486F-A9AA-073D798CC60D}.Release|x64.Build.0 = Release|Any CPU
{4D50F5B2-4782-486F-A9AA-073D798CC60D}.Release|x86.ActiveCfg = Release|Any CPU
{4D50F5B2-4782-486F-A9AA-073D798CC60D}.Release|x86.Build.0 = Release|Any CPU
{4535F88F-EA1C-4C6F-84D5-93535EE1568C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4535F88F-EA1C-4C6F-84D5-93535EE1568C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4535F88F-EA1C-4C6F-84D5-93535EE1568C}.Debug|x64.ActiveCfg = Debug|Any CPU
{4535F88F-EA1C-4C6F-84D5-93535EE1568C}.Debug|x64.Build.0 = Debug|Any CPU
{4535F88F-EA1C-4C6F-84D5-93535EE1568C}.Debug|x86.ActiveCfg = Debug|Any CPU
{4535F88F-EA1C-4C6F-84D5-93535EE1568C}.Debug|x86.Build.0 = Debug|Any CPU
{4535F88F-EA1C-4C6F-84D5-93535EE1568C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4535F88F-EA1C-4C6F-84D5-93535EE1568C}.Release|Any CPU.Build.0 = Release|Any CPU
{4535F88F-EA1C-4C6F-84D5-93535EE1568C}.Release|x64.ActiveCfg = Release|Any CPU
{4535F88F-EA1C-4C6F-84D5-93535EE1568C}.Release|x64.Build.0 = Release|Any CPU
{4535F88F-EA1C-4C6F-84D5-93535EE1568C}.Release|x86.ActiveCfg = Release|Any CPU
{4535F88F-EA1C-4C6F-84D5-93535EE1568C}.Release|x86.Build.0 = Release|Any CPU
{562E5DB9-761B-4DE9-98CB-C364F6DE558E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{562E5DB9-761B-4DE9-98CB-C364F6DE558E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{562E5DB9-761B-4DE9-98CB-C364F6DE558E}.Debug|x64.ActiveCfg = Debug|Any CPU
{562E5DB9-761B-4DE9-98CB-C364F6DE558E}.Debug|x64.Build.0 = Debug|Any CPU
{562E5DB9-761B-4DE9-98CB-C364F6DE558E}.Debug|x86.ActiveCfg = Debug|Any CPU
{562E5DB9-761B-4DE9-98CB-C364F6DE558E}.Debug|x86.Build.0 = Debug|Any CPU
{562E5DB9-761B-4DE9-98CB-C364F6DE558E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{562E5DB9-761B-4DE9-98CB-C364F6DE558E}.Release|Any CPU.Build.0 = Release|Any CPU
{562E5DB9-761B-4DE9-98CB-C364F6DE558E}.Release|x64.ActiveCfg = Release|Any CPU
{562E5DB9-761B-4DE9-98CB-C364F6DE558E}.Release|x64.Build.0 = Release|Any CPU
{562E5DB9-761B-4DE9-98CB-C364F6DE558E}.Release|x86.ActiveCfg = Release|Any CPU
{562E5DB9-761B-4DE9-98CB-C364F6DE558E}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -759,7 +824,15 @@ Global
{4A7305AE-AAAE-43AE-AAB2-DA58DACC6FA8} = {EFF7632B-821E-4CFC-B4A0-ED4B24296B17}
{5A69FD28-D814-490E-A76B-B0A5F88C25B2} = {EFF7632B-821E-4CFC-B4A0-ED4B24296B17}
{8E7BECBC-7226-4778-B8F2-8EBDFF0D3BA4} = {EFF7632B-821E-4CFC-B4A0-ED4B24296B17}

{21303FBF-2A2B-17C2-D2DF-3E924022E940} = {8AFC9781-F6F1-4696-BB4A-9ED7CA9D612B}
{C6DC28DC-95CE-42DA-B02C-FFB2BA1CB1A2} = {21303FBF-2A2B-17C2-D2DF-3E924022E940}
{D4587EC0-1B16-8420-7502-A967139249D4} = {1C217BB2-CE16-41CC-9D47-0FC0DB60BDB3}
{53193780-CD18-2643-6953-C26F59EAEDF5} = {5B448FF6-EC42-491D-A22E-1DC8B618E6D5}
{00205C88-F000-28F2-A910-C6FA00E065EE} = {E5637F81-2FB9-4CD7-900D-455363B142A7}
{4D50F5B2-4782-486F-A9AA-073D798CC60D} = {00205C88-F000-28F2-A910-C6FA00E065EE}
{5BD6F026-413E-9AC5-D159-8E8D9F26EF1B} = {EFF7632B-821E-4CFC-B4A0-ED4B24296B17}
{4535F88F-EA1C-4C6F-84D5-93535EE1568C} = {5BD6F026-413E-9AC5-D159-8E8D9F26EF1B}
{562E5DB9-761B-4DE9-98CB-C364F6DE558E} = {5BD6F026-413E-9AC5-D159-8E8D9F26EF1B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AB41CB55-35EA-4986-A522-387AB3402E71}
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ The Durable Task Scheduler for Azure Functions is a managed backend that is curr

This SDK can also be used with the Durable Task Scheduler directly, without any Durable Functions dependency. To get started, sign up for the [Durable Task Scheduler private preview](https://techcommunity.microsoft.com/blog/appsonazureblog/announcing-limited-early-access-of-the-durable-task-scheduler-for-azure-durable-/4286526) and follow the instructions to create a new Durable Task Scheduler instance. Once granted access to the private preview GitHub repository, you can find samples and documentation for getting started [here](https://github.com/Azure/Azure-Functions-Durable-Task-Scheduler-Private-Preview/tree/main/samples/portable-sdk/dotnet/AspNetWebApp#readme).

The [serverless activities sample](samples/serverless/README.md) shows how to declare selected activities for DTS-managed serverless execution and build the remote worker container image separately from the declarer app.

## Obtaining the Protobuf definitions

This project utilizes protobuf definitions from [durabletask-protobuf](https://github.com/microsoft/durabletask-protobuf), which are copied (vendored) into this repository under the `src/Grpc` directory. See the corresponding [README.md](./src/Grpc/README.md) for more information about how to update the protobuf definitions.
Expand Down
71 changes: 71 additions & 0 deletions samples/serverless/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Serverless Activities Sample

This sample shows how to run selected Durable Task activities in DTS-managed serverless sandboxes.

The sample is intentionally split into two projects:

| Path | Purpose |
| --- | --- |
| `shared/` | Defines activity name constants shared by the main app and remote worker. |
| `main-app/` | Runs locally or in a normal app host. It declares the serverless activity and starts one hello orchestration. |
| `remote-worker/` | Builds the container image that DTS starts inside a serverless sandbox. It contains the remote hello activity. |

## Build

```powershell
dotnet build .\samples\serverless\main-app\main-app.csproj
dotnet build .\samples\serverless\remote-worker\remote-worker.csproj
```

## Build the remote worker image

Run from the repository root:

```powershell
$image = "<acr-name>.azurecr.io/dts-serverless-sample:<tag>"
docker build -f .\samples\serverless\remote-worker\Containerfile -t $image .
docker push $image
```

## Run a hello orchestration

The main app uses `DefaultAzureCredential`; sign in with Azure CLI or configure another supported Azure identity before running it.
After pushing the remote worker image, set `ContainerImage` in
`main-app/WorkerProfiles.cs` to the pushed image reference. The worker profile
class declares the image, CPU, memory, max concurrency, and serverless activity
names with `options.AddActivity(...)`. The main app and remote worker both use
the `shared/ActivityNames.cs` constants so the declaration and worker registration
stay in sync.

Update `main-app/appsettings.json` with your scheduler endpoint and task hub:

```json
{
"ServerlessSample": {
"EndpointAddress": "https://<scheduler-endpoint>",
"TaskHubName": "ServerlessPocHub"
}
}
```

Then run the main app:

```powershell
Push-Location .\samples\serverless\main-app
dotnet run
Pop-Location
```

Expected output includes the serverless activity result:

```text
Runtime status: Completed
Output: "hello locally: serverless-sample; hello remotely from <sandbox> pid=<pid>: serverless-sample"
```

Use the Durable Task Scheduler dashboard's Serverless Activities preview tab to inspect serverless activity runtimes and stream runtime logs.

The remote worker image does not need customer-provided DTS runtime settings.
DTS injects the scheduler endpoint, task hub, worker profile, capacity, substrate,
and sandbox identifier when it starts the sandbox. The worker reports the
activities registered in the image when it connects.
18 changes: 18 additions & 0 deletions samples/serverless/main-app/Activities.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace Microsoft.DurableTask.Samples.Serverless.MainApp;

internal static class ServerlessTaskNames
{
public const string LocalHello = "LocalHello";
public const string HelloOrchestrator = nameof(HelloOrchestrator);
}

[DurableTask(ServerlessTaskNames.LocalHello)]
internal sealed class LocalHelloActivity : TaskActivity<string, string>
{
public override Task<string> RunAsync(TaskActivityContext context, string input)
=> Task.FromResult($"hello locally: {input}");
}

18 changes: 18 additions & 0 deletions samples/serverless/main-app/Orchestrators.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using Microsoft.DurableTask;
using Microsoft.DurableTask.Samples.Serverless.Shared;

namespace Microsoft.DurableTask.Samples.Serverless.MainApp;

[DurableTask(nameof(HelloOrchestrator))]
internal sealed class HelloOrchestrator : TaskOrchestrator<string, string>
{
public override async Task<string> RunAsync(TaskOrchestrationContext context, string input)
{
string localResult = await context.CallActivityAsync<string>(ServerlessTaskNames.LocalHello, input);
string remoteResult = await context.CallActivityAsync<string>(ActivityNames.RemoteHello, input);
return $"{localResult}; {remoteResult}";
}
}
69 changes: 69 additions & 0 deletions samples/serverless/main-app/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using Azure.Core;
using Azure.Identity;
using Microsoft.DurableTask;
using Microsoft.DurableTask.Client;
using Microsoft.DurableTask.Client.AzureManaged;
using Microsoft.DurableTask.Samples.Serverless.MainApp;
using Microsoft.DurableTask.Worker;
using Microsoft.DurableTask.Worker.AzureManaged;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

const string Input = "serverless-sample";

HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
string endpoint = builder.Configuration["ServerlessSample:EndpointAddress"]!;
string taskHub = builder.Configuration["ServerlessSample:TaskHubName"]!;
TokenCredential credential = new DefaultAzureCredential();
builder.Logging.AddSimpleConsole(options =>
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why add this console? we really need this?

{
options.SingleLine = true;
options.UseUtcTimestamp = true;
options.TimestampFormat = "yyyy-MM-ddTHH:mm:ss.fffZ ";
});

builder.Services.AddDurableTaskWorker(workerBuilder =>
{
workerBuilder.AddTasks(tasks => tasks.AddAllGeneratedTasks());
workerBuilder.UseDurableTaskScheduler(options =>
{
options.EndpointAddress = endpoint;
options.TaskHubName = taskHub;
options.Credential = credential;
});

workerBuilder.EnableServerlessActivities();
});

builder.Services.AddDurableTaskClient(clientBuilder =>
{
clientBuilder.UseDurableTaskScheduler(options =>
{
options.EndpointAddress = endpoint;
options.TaskHubName = taskHub;
options.Credential = credential;
});
});

using IHost host = builder.Build();

await host.StartAsync();

DurableTaskClient client = host.Services.GetRequiredService<DurableTaskClient>();
string instanceId = await client.ScheduleNewOrchestrationInstanceAsync(
ServerlessTaskNames.HelloOrchestrator,
input: Input);
OrchestrationMetadata? result = await client.WaitForInstanceCompletionAsync(
instanceId,
getInputsAndOutputs: true);

Console.WriteLine($"Started orchestration: {instanceId}");
Console.WriteLine($"Runtime status: {result?.RuntimeStatus}");
Console.WriteLine($"Output: {result?.SerializedOutput ?? "<null>"}");

await host.StopAsync();
20 changes: 20 additions & 0 deletions samples/serverless/main-app/WorkerProfiles.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using Microsoft.DurableTask.Worker.AzureManaged.Serverless;
using Microsoft.DurableTask.Samples.Serverless.Shared;

namespace Microsoft.DurableTask.Samples.Serverless.MainApp;

[ServerlessWorkerProfile("default")]
internal sealed class DefaultServerlessWorkerProfile : IServerlessWorkerProfile
{
public void Configure(ServerlessOptions options)
{
options.ContainerImage = Environment.GetEnvironmentVariable("DTS_SERVERLESS_CONTAINER_IMAGE") ?? "serverless-remote-worker:local";
options.Cpu = "1000m";
options.Memory = "2048Mi";
options.MaxConcurrentActivities = 1;
options.AddActivity(ActivityNames.RemoteHello);
}
}
6 changes: 6 additions & 0 deletions samples/serverless/main-app/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"ServerlessSample": {
"EndpointAddress": "https://<scheduler-endpoint>",
"TaskHubName": "ServerlessPocHub"
}
}
25 changes: 25 additions & 0 deletions samples/serverless/main-app/main-app.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<AssemblyName>ServerlessMainApp</AssemblyName>
<RootNamespace>Microsoft.DurableTask.Samples.Serverless.MainApp</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Microsoft.Extensions.Hosting" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(SrcRoot)Client/AzureManaged/Client.AzureManaged.csproj" />
<ProjectReference Include="$(SrcRoot)Worker/AzureManaged/Worker.AzureManaged.csproj" />
<ProjectReference Include="$(SrcRoot)Extensions/AzureManagedServerless/AzureManagedServerless.csproj" />
<ProjectReference Include="..\shared\shared.csproj" />
<ProjectReference Include="$(SrcRoot)Analyzers/Analyzers.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<ProjectReference Include="$(SrcRoot)Generators/Generators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>

</Project>
16 changes: 16 additions & 0 deletions samples/serverless/remote-worker/Activities.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using Microsoft.DurableTask;
using Microsoft.DurableTask.Samples.Serverless.Shared;

namespace Microsoft.DurableTask.Samples.Serverless.RemoteWorker;

[DurableTask(ActivityNames.RemoteHello)]
internal sealed class RemoteHelloActivity : TaskActivity<string, string>
{
public override Task<string> RunAsync(TaskActivityContext context, string input)
{
return Task.FromResult($"hello remotely from {Environment.MachineName} pid={Environment.ProcessId}: {input}");
}
}
Loading
Loading