Skip to content

Commit

Permalink
Add methods to handle activity run asynchronously flag
Browse files Browse the repository at this point in the history
New methods have been added to handle the custom property 'runAsynchronously' on a JsonObject activity. These methods will help in getting and setting a value that indicates whether a specified activity can trigger a workflow asynchronously. This additional level of control can enhance workflow execution based on specific requirements.
  • Loading branch information
sfmskywalker committed Dec 18, 2023
1 parent 6db3cc9 commit b5d38b6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/clients/Elsa.Api.Client/Extensions/ActivityExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,14 @@ public static void SetDisplayText(this JsonObject activity, string? value)
/// <param name="activity">The JsonObject representing the activity.</param>
/// <returns>Returns true if the activity is a workflow definition activity; otherwise, false.</returns>
public static bool GetIsWorkflowDefinitionActivity(this JsonObject activity) => activity.ContainsKey("workflowDefinitionId") && activity.ContainsKey("workflowDefinitionVersionId");

/// <summary>
/// Gets a value indicating whether the specified activity can trigger the workflow.
/// </summary>
public static bool? GetRunAsynchronously(this JsonObject activity) => activity.GetProperty<bool>("customProperties", "runAsynchronously");

/// <summary>
/// Sets a value indicating whether the specified activity can trigger the workflow.
/// </summary>
public static void SetRunAsynchronously(this JsonObject activity, bool value) => activity.SetProperty(JsonValue.Create(value), "customProperties", "runAsynchronously");
}

0 comments on commit b5d38b6

Please sign in to comment.