From 1d0e44fb86495f5ce02438beb672ebcf3d6e64c7 Mon Sep 17 00:00:00 2001 From: Shyju Krishnankutty Date: Tue, 17 Feb 2026 19:06:46 -0800 Subject: [PATCH] Add YieldOutputAsync calls to 05_WorkflowEvents sample executors The integration test asserts that WorkflowOutputEvent is found in the stream, but the sample executors only used AddEventAsync for custom events and never called YieldOutputAsync. Since WorkflowOutputEvent is only emitted via explicit YieldOutputAsync calls, the assertion would fail. Added YieldOutputAsync to each executor to match the test expectation and demonstrate the API in the sample. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Workflow/ConsoleApps/05_WorkflowEvents/Executors.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dotnet/samples/Durable/Workflow/ConsoleApps/05_WorkflowEvents/Executors.cs b/dotnet/samples/Durable/Workflow/ConsoleApps/05_WorkflowEvents/Executors.cs index e9980f6445..47880f0fff 100644 --- a/dotnet/samples/Durable/Workflow/ConsoleApps/05_WorkflowEvents/Executors.cs +++ b/dotnet/samples/Durable/Workflow/ConsoleApps/05_WorkflowEvents/Executors.cs @@ -40,7 +40,7 @@ internal sealed record Order(string Id, DateTime OrderDate, bool IsCancelled, st internal sealed record Customer(string Name, string Email); // ═══════════════════════════════════════════════════════════════════════════════ -// Executors - emit events via IWorkflowContext.AddEventAsync +// Executors - emit events via AddEventAsync and YieldOutputAsync // ═══════════════════════════════════════════════════════════════════════════════ /// @@ -67,6 +67,9 @@ internal sealed class OrderLookup() : Executor("OrderLookup") await context.AddEventAsync(new OrderFoundEvent(order.Customer.Name), cancellationToken); + // YieldOutputAsync emits a WorkflowOutputEvent observable via streaming + await context.YieldOutputAsync(order, cancellationToken); + return order; } } @@ -96,6 +99,8 @@ internal sealed class OrderCancel() : Executor("OrderCancel") await context.AddEventAsync(new CancellationProgressEvent(100, "Complete"), cancellationToken); await context.AddEventAsync(new OrderCancelledEvent(), cancellationToken); + await context.YieldOutputAsync(cancelledOrder, cancellationToken); + return cancelledOrder; } } @@ -117,6 +122,8 @@ internal sealed class SendEmail() : Executor("SendEmail") await context.AddEventAsync(new EmailSentEvent(message.Customer.Email), cancellationToken); + await context.YieldOutputAsync(result, cancellationToken); + return result; } }