Skip to content

Add lambda.DurableFunction blueprint (vs2026)#2445

Open
GarrettBeatty wants to merge 2 commits into
durabletesting2from
gcbeatty/durable-function-blueprint
Open

Add lambda.DurableFunction blueprint (vs2026)#2445
GarrettBeatty wants to merge 2 commits into
durabletesting2from
gcbeatty/durable-function-blueprint

Conversation

@GarrettBeatty

Copy link
Copy Markdown
Contributor

Summary

Adds a new dotnet new template — lambda.DurableFunction — under Blueprints/BlueprintDefinitions/vs2026 that scaffolds a Lambda durable execution workflow.

  • Uses the Annotations class-library programming model ([LambdaFunction] + [DurableExecution]) on the managed dotnet10 runtime (durable execution requires dotnet10).
  • Sample ProcessOrder workflow demonstrates the core durable primitives:
    • StepAsync — checkpointed step
    • StepAsync + RetryStrategy.Exponential with StepSemantics.AtMostOncePerRetry
    • WaitAsync — suspend timer (no compute charge while suspended)
    • RunInChildContextAsync — grouping related steps
  • Generated serverless.template includes DurableConfig and the AWSLambdaBasicDurableExecutionRolePolicy managed policy (kept in sync by the source generator).
  • Includes a test project that drives the workflow locally via Amazon.Lambda.DurableExecution.Testing (no AWS resources needed).
  • Registers the template in Blueprints/README.md.

vs2026 only for now (matches the existing vs2026 layout convention).

Testing

Validated locally (durable preview packages packed into a local NuGet feed):

  • dotnet build of the function project succeeds on net10.0; source generator emits Function_ProcessOrder_Generated::ProcessOrder, matching the handler in serverless.template.
  • dotnet test — both unit tests pass, no warnings.
  • dotnet new lambda.DurableFunction --name <X> instantiates correctly and the shortName resolves.

Notes

  • Amazon.Lambda.DurableExecution.Testing is not yet published to NuGet; the template references 0.0.1-preview. The test project will restore once that package is published (or via a local feed in the meantime).
  • Blueprint-only change — no .autover change file needed (autover tracks Libraries/src projects only).

Adds a new 'dotnet new' template (shortName: lambda.DurableFunction) under
Blueprints/BlueprintDefinitions/vs2026 that scaffolds a Lambda durable
execution workflow using the Annotations class-library programming model on
the managed dotnet10 runtime.

The sample workflow demonstrates the core durable primitives: StepAsync, a
step with an exponential RetryStrategy and AtMostOncePerRetry semantics,
WaitAsync (suspend timer), and RunInChildContextAsync. The generated
serverless.template includes DurableConfig and the
AWSLambdaBasicDurableExecutionRolePolicy managed policy. A test project drives
the workflow locally via Amazon.Lambda.DurableExecution.Testing.

Also registers the template in Blueprints/README.md.
@GarrettBeatty GarrettBeatty added the Release Not Needed Add this label if a PR does not need to be released. label Jun 26, 2026
<PackageReference Include="Amazon.Lambda.Core" Version="3.1.1" />
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="3.0.0" />
<PackageReference Include="Amazon.Lambda.Annotations" Version="2.0.1" />
<PackageReference Include="Amazon.Lambda.DurableExecution" Version="0.1.1-preview" />

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

will update to ga version once released

<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="3.1.1" />
<PackageReference Include="Amazon.Lambda.TestUtilities" Version="4.1.0" />
<PackageReference Include="Amazon.Lambda.DurableExecution.Testing" Version="0.0.1-preview" />

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

since this pr isnt merged yet, i tested with local nuget feed.


  # 1. Pack the three required packages into a local feed
  FEED=/tmp/durable-feed && mkdir -p "$FEED"
  cd Libraries/src/Amazon.Lambda.Annotations            && dotnet pack -c Release -o "$FEED"
  cd ../Amazon.Lambda.DurableExecution                  && dotnet pack -c Release -o "$FEED"
  cd ../Amazon.Lambda.DurableExecution.Testing          && dotnet pack -c Release -o "$FEED"

  # 2. Install the template from the blueprint folder
  cd <repo>/Blueprints/BlueprintDefinitions/vs2026/DurableFunction/template/src/BlueprintBaseName.1
  dotnet new install .    # or install from the .template.config location

  # 3. Instantiate into a scratch dir
  mkdir /tmp/dtest && cd /tmp/dtest
  dotnet new lambda.DurableFunction --name MyOrders

  # 4. Build + test against the local feed
  dotnet test --source "$FEED" --source https://api.nuget.org/v3/index.json

@GarrettBeatty GarrettBeatty marked this pull request as ready for review June 29, 2026 17:02
@GarrettBeatty GarrettBeatty requested review from a team as code owners June 29, 2026 17:02
@GarrettBeatty GarrettBeatty requested review from normj and philasmar and removed request for a team June 29, 2026 17:02
@@ -0,0 +1,39 @@
{

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

intentionally only added to vs2026. didnt feel like it was worth adding to 2024 folder since dotnet8 will be end of life soon

@GarrettBeatty

Copy link
Copy Markdown
Contributor Author

The test project isn't actually bundled when doing a new project (same with other projects) but adding here to be consistent

@normj normj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The pattern of the template library is templates that start with the lambda. prefix deploy directory to Lambda. For example using the dotnet lambda deploy-function command. For templates that deploy via CloudFormation start with serverless. and you would deploy via the dotnet lambda deploy-serverless command.

I suggest we have 2 templates. One that goes directly to Lambda and uses the static wrapper method instead of annotations so it can be deploy straight to Lambda. Then a second serverless.* template that is what you have here.

@normj

normj commented Jun 30, 2026

Copy link
Copy Markdown
Member

The test project isn't actually bundled when doing a new project (same with other projects) but adding here to be consistent

The test project is still useful when you create the template via Visual Studio.

@philasmar philasmar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

approving assuming you address norm's feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Release Not Needed Add this label if a PR does not need to be released.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants