Skip to content

Commit

Permalink
Merge pull request #66 from serverlessworkflow/feat-await-processes
Browse files Browse the repository at this point in the history
Added a new `await` property to `ProcessTypeDefinition`
  • Loading branch information
cdavernas authored Oct 25, 2024
2 parents 5a4a68b + 1b36277 commit 97b11cb
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,11 @@ public interface IRunTaskDefinitionBuilder
/// <returns>A new <see cref="IWorkflowProcessDefinitionBuilder"/></returns>
IWorkflowProcessDefinitionBuilder Workflow();

/// <summary>
/// Configures whether the task to build should await the execution of the defined process
/// </summary>
/// <param name="await">A boolean indicating whether or not the task to build should await the execution of the defined process</param>
/// <returns>The configured <see cref="IRunTaskDefinitionBuilder"/></returns>
IRunTaskDefinitionBuilder Await(bool await);

}
15 changes: 14 additions & 1 deletion src/ServerlessWorkflow.Sdk.Builders/RunTaskDefinitionBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ public class RunTaskDefinitionBuilder
: TaskDefinitionBuilder<IRunTaskDefinitionBuilder, RunTaskDefinition>, IRunTaskDefinitionBuilder
{

/// <summary>
/// Gets/sets a boolean indicating whether or not the task to build should await the execution of the defined process
/// </summary>
protected bool? AwaitProcess { get; set; }

/// <summary>
/// Gets/sets the process to run
/// </summary>
Expand Down Expand Up @@ -59,6 +64,13 @@ public virtual IWorkflowProcessDefinitionBuilder Workflow()
return builder;
}

/// <inheritdoc/>
public virtual IRunTaskDefinitionBuilder Await(bool await)
{
this.AwaitProcess = await;
return this;
}

/// <inheritdoc/>
public override RunTaskDefinition Build()
{
Expand All @@ -71,7 +83,8 @@ public override RunTaskDefinition Build()
Container = process is ContainerProcessDefinition container ? container : null,
Script = process is ScriptProcessDefinition script ? script : null,
Shell = process is ShellProcessDefinition shell ? shell : null,
Workflow = process is WorkflowProcessDefinition workflow ? workflow : null
Workflow = process is WorkflowProcessDefinition workflow ? workflow : null,
Await = this.AwaitProcess
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<VersionPrefix>1.0.0</VersionPrefix>
<VersionSuffix>alpha5</VersionSuffix>
<VersionSuffix>alpha5.1</VersionSuffix>
<AssemblyVersion>$(VersionPrefix)</AssemblyVersion>
<FileVersion>$(VersionPrefix)</FileVersion>
<NeutralLanguage>en</NeutralLanguage>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<VersionPrefix>1.0.0</VersionPrefix>
<VersionSuffix>alpha5</VersionSuffix>
<VersionSuffix>alpha5.1</VersionSuffix>
<AssemblyVersion>$(VersionPrefix)</AssemblyVersion>
<FileVersion>$(VersionPrefix)</FileVersion>
<NeutralLanguage>en</NeutralLanguage>
Expand Down
6 changes: 6 additions & 0 deletions src/ServerlessWorkflow.Sdk/Models/ProcessTypeDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ public record ProcessTypeDefinition
[DataMember(Name = "workflow", Order = 4), JsonPropertyName("workflow"), JsonPropertyOrder(4), YamlMember(Alias = "workflow", Order = 4)]
public virtual WorkflowProcessDefinition? Workflow { get; set; }

/// <summary>
/// Gets/sets a boolean indicating whether or not to await the process completion before continuing. Defaults to 'true'.
/// </summary>
[DataMember(Name = "await", Order = 5), JsonPropertyName("await"), JsonPropertyOrder(5), YamlMember(Alias = "await", Order = 5)]
public virtual bool? Await { get; set; }

/// <summary>
/// Gets the type of the defined process tasks
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/ServerlessWorkflow.Sdk/ServerlessWorkflow.Sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<VersionPrefix>1.0.0</VersionPrefix>
<VersionSuffix>alpha5</VersionSuffix>
<VersionSuffix>alpha5.1</VersionSuffix>
<AssemblyVersion>$(VersionPrefix)</AssemblyVersion>
<FileVersion>$(VersionPrefix)</FileVersion>
<NeutralLanguage>en</NeutralLanguage>
Expand Down

0 comments on commit 97b11cb

Please sign in to comment.