-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new create builder overloads without callbacks (#366)
* Add new builder overload without callback * Add unit tests * Fix TaskNameTests namsespace * Update changelog * Fix tests passing null
- Loading branch information
Showing
14 changed files
with
379 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" /> | ||
|
||
<!-- Real projects would use package references --> | ||
<!-- | ||
<PackageReference Include="Microsoft.DurableTask.Client.Grpc" Version="1.5.0" /> | ||
<PackageReference Include="Microsoft.DurableTask.Worker.Grpc" Version="1.5.0" /> | ||
--> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<!-- Using p2p references so we can show latest changes in samples. --> | ||
<ProjectReference Include="$(SrcRoot)Client/Grpc/Client.Grpc.csproj" /> | ||
<ProjectReference Include="$(SrcRoot)Worker/Grpc/Worker.Grpc.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
// This app differs from samples/ConsoleApp in that we show the absolute minimum code needed to run a Durable Task application. | ||
|
||
using ConsoleAppMinimal; | ||
using Microsoft.DurableTask.Client; | ||
using Microsoft.DurableTask.Worker; | ||
using Microsoft.Extensions.Hosting; | ||
|
||
HostApplicationBuilder builder = Host.CreateApplicationBuilder(args); | ||
|
||
builder.Services.AddDurableTaskClient().UseGrpc(); | ||
builder.Services.AddDurableTaskWorker() | ||
.AddTasks(tasks => | ||
{ | ||
tasks.AddOrchestrator<HelloSequenceOrchestrator>(); | ||
tasks.AddActivity<SayHelloActivity>(); | ||
}) | ||
.UseGrpc(); | ||
|
||
IHost host = builder.Build(); | ||
await host.StartAsync(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using Microsoft.DurableTask; | ||
|
||
namespace ConsoleAppMinimal; | ||
|
||
[DurableTask("HelloSequence")] | ||
public class HelloSequenceOrchestrator : TaskOrchestrator<string, IEnumerable<string>> | ||
{ | ||
public override async Task<IEnumerable<string>> RunAsync(TaskOrchestrationContext context, string input) | ||
{ | ||
IEnumerable<string> greetings = | ||
[ | ||
await context.CallActivityAsync<string>("SayHello", "Tokyo"), | ||
await context.CallActivityAsync<string>("SayHello", "London"), | ||
await context.CallActivityAsync<string>("SayHello", "Seattle"), | ||
]; | ||
|
||
return greetings; | ||
} | ||
} | ||
|
||
[DurableTask("SayHello")] | ||
public class SayHelloActivity : TaskActivity<string, string> | ||
{ | ||
public override Task<string> RunAsync(TaskActivityContext context, string city) | ||
{ | ||
return Task.FromResult($"Hello {city}!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
- Fix filter not being passed along in `PurgeAllInstancesAsync` (https://github.com/microsoft/durabletask-dotnet/pull/289) | ||
- Add new `IDurableTaskClientBuilder AddDurableTaskClient(IServiceCollection, string?)` API |
Oops, something went wrong.