-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for experimental workflow task events (#113)
- Loading branch information
Showing
13 changed files
with
311 additions
and
22 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
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,33 @@ | ||
using System; | ||
|
||
namespace Temporalio.Worker | ||
{ | ||
/// <summary> | ||
/// Event arguments for workflow task completed events. | ||
/// </summary> | ||
/// <remarks> | ||
/// WARNING: This is experimental and there are many caveats about its use. It is important to | ||
/// read the documentation on <see cref="TemporalWorkerOptions.WorkflowTaskStarting" />. | ||
/// </remarks> | ||
public class WorkflowTaskCompletedEventArgs : WorkflowTaskEventArgs | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="WorkflowTaskCompletedEventArgs"/> class. | ||
/// </summary> | ||
/// <param name="workflowInstance">Workflow instance.</param> | ||
/// <param name="taskFailureException">Task failure exception.</param> | ||
internal WorkflowTaskCompletedEventArgs( | ||
WorkflowInstance workflowInstance, Exception? taskFailureException) | ||
: base(workflowInstance) => TaskFailureException = taskFailureException; | ||
|
||
/// <summary> | ||
/// Gets the task failure if any. | ||
/// </summary> | ||
/// <remarks> | ||
/// This is the task failure not the workflow failure. Task failures occur on all exceptions | ||
/// except Temporal exceptions thrown from the workflow. These cause the workflow to | ||
/// continually retry until code is fixed to solve the exception. | ||
/// </remarks> | ||
public Exception? TaskFailureException { get; private init; } | ||
} | ||
} |
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,33 @@ | ||
using System; | ||
|
||
namespace Temporalio.Worker | ||
{ | ||
/// <summary> | ||
/// Base class for workflow task event arguments. | ||
/// </summary> | ||
/// <remarks> | ||
/// WARNING: This is experimental and there are many caveats about its use. It is important to | ||
/// read the documentation on <see cref="TemporalWorkerOptions.WorkflowTaskStarting" />. | ||
/// </remarks> | ||
public abstract class WorkflowTaskEventArgs : EventArgs | ||
{ | ||
private readonly WorkflowInstance workflowInstance; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="WorkflowTaskEventArgs"/> class. | ||
/// </summary> | ||
/// <param name="workflowInstance">Workflow instance.</param> | ||
internal WorkflowTaskEventArgs(WorkflowInstance workflowInstance) => | ||
this.workflowInstance = workflowInstance; | ||
|
||
/// <summary> | ||
/// Gets the workflow information. | ||
/// </summary> | ||
public Workflows.WorkflowInfo WorkflowInfo => workflowInstance.Info; | ||
|
||
/// <summary> | ||
/// Gets the workflow definition. | ||
/// </summary> | ||
public Workflows.WorkflowDefinition WorkflowDefinition => workflowInstance.Definition; | ||
} | ||
} |
Oops, something went wrong.