mirror of https://github.com/dapr/quickstarts.git
25 lines
585 B
C#
25 lines
585 B
C#
using Dapr.Workflow;
|
|
using FanOutFanIn;
|
|
using FanOutFanIn.Activities;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
builder.Services.AddDaprWorkflow(options =>
|
|
{
|
|
options.RegisterWorkflow<FanOutFanInWorkflow>();
|
|
options.RegisterActivity<GetWordLength>();
|
|
});
|
|
var app = builder.Build();
|
|
|
|
app.MapPost("/start", async (
|
|
string[] words,
|
|
DaprWorkflowClient workflowClient) =>
|
|
{
|
|
var instanceId = await workflowClient.ScheduleNewWorkflowAsync(
|
|
name: nameof(FanOutFanInWorkflow),
|
|
input: words);
|
|
|
|
return Results.Accepted(instanceId);
|
|
});
|
|
|
|
app.Run();
|