This commit is contained in:
Shyju Krishnankutty
2026-01-21 10:49:10 -08:00
Unverified
parent 00650f2525
commit 588e0bc0b2
13 changed files with 258 additions and 43 deletions
@@ -20,22 +20,31 @@ Func<string, string> orderParserFunc = input =>
};
var orderParserExecutor = orderParserFunc.BindAsExecutor("OrderParser");
Func<string, string> cancelOrderFunc = input => $"Cancelled order:{input}";
var orderArchiver = orderParserFunc.BindAsExecutor("OrderArchiver");
OrderLookupExecutor orderLookupExecutor = new();
OrderEnricherExecutor orderEnricherExeecutor = new();
PaymentProcessorExecutor paymentProcessorExecutor = new();
Workflow workflow = new WorkflowBuilder(orderParserExecutor)
Workflow processOrder = new WorkflowBuilder(orderParserExecutor)
.WithName("FulfillOrder")
.WithDescription("Looks up an order by ID and run payment processing")
.AddEdge(orderParserExecutor, orderLookupExecutor)
.AddEdge(orderLookupExecutor, orderEnricherExeecutor)
.AddEdge(orderEnricherExeecutor, paymentProcessorExecutor)
.WithOutputFrom(paymentProcessorExecutor)
.Build();
Workflow cancelOrder = new WorkflowBuilder(orderParserExecutor)
.WithName("CancelOrder")
.WithDescription("Cancel an order")
.AddEdge(orderParserExecutor, orderLookupExecutor)
.AddEdge(orderLookupExecutor, orderArchiver)
.Build();
var host = FunctionsApplication.CreateBuilder(args)
.ConfigureFunctionsWebApplication()
.ConfigureDurableOptions(options => options.Workflows.AddWorkflow(workflow))
.ConfigureDurableOptions(options => options.Workflows.AddWorkflow([processOrder, cancelOrder]))
.Build();
host.Run();
@@ -8,7 +8,7 @@ Content-Type: text/plain
QWERTY80853
### Look up a short order id
POST {{authority}}/api/workflows/FulfillOrder/run
POST {{authority}}/api/workflows/CancelOrder/run
Content-Type: text/plain
12345
@@ -43,7 +43,8 @@ var workflow = new WorkflowBuilder(startExecutor)
FunctionsApplication.CreateBuilder(args)
.ConfigureFunctionsWebApplication()
.ConfigureDurableOptions(options =>
{
// Configure workflows
options.Workflows.AddWorkflow(workflow);
}).Build().Run();
{
// Configure workflows
options.Workflows.AddWorkflow(workflow, enableMcpToolTrigger: true);
})
.Build().Run();