Skip to content

Commit 97b11cb

Browse files
authored
Merge pull request #66 from serverlessworkflow/feat-await-processes
Added a new `await` property to `ProcessTypeDefinition`
2 parents 5a4a68b + 1b36277 commit 97b11cb

File tree

6 files changed

+30
-4
lines changed

6 files changed

+30
-4
lines changed

src/ServerlessWorkflow.Sdk.Builders/Interfaces/IRunTaskDefinitionBuilder.cs

+7
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,11 @@ public interface IRunTaskDefinitionBuilder
4444
/// <returns>A new <see cref="IWorkflowProcessDefinitionBuilder"/></returns>
4545
IWorkflowProcessDefinitionBuilder Workflow();
4646

47+
/// <summary>
48+
/// Configures whether the task to build should await the execution of the defined process
49+
/// </summary>
50+
/// <param name="await">A boolean indicating whether or not the task to build should await the execution of the defined process</param>
51+
/// <returns>The configured <see cref="IRunTaskDefinitionBuilder"/></returns>
52+
IRunTaskDefinitionBuilder Await(bool await);
53+
4754
}

src/ServerlessWorkflow.Sdk.Builders/RunTaskDefinitionBuilder.cs

+14-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ public class RunTaskDefinitionBuilder
2222
: TaskDefinitionBuilder<IRunTaskDefinitionBuilder, RunTaskDefinition>, IRunTaskDefinitionBuilder
2323
{
2424

25+
/// <summary>
26+
/// Gets/sets a boolean indicating whether or not the task to build should await the execution of the defined process
27+
/// </summary>
28+
protected bool? AwaitProcess { get; set; }
29+
2530
/// <summary>
2631
/// Gets/sets the process to run
2732
/// </summary>
@@ -59,6 +64,13 @@ public virtual IWorkflowProcessDefinitionBuilder Workflow()
5964
return builder;
6065
}
6166

67+
/// <inheritdoc/>
68+
public virtual IRunTaskDefinitionBuilder Await(bool await)
69+
{
70+
this.AwaitProcess = await;
71+
return this;
72+
}
73+
6274
/// <inheritdoc/>
6375
public override RunTaskDefinition Build()
6476
{
@@ -71,7 +83,8 @@ public override RunTaskDefinition Build()
7183
Container = process is ContainerProcessDefinition container ? container : null,
7284
Script = process is ScriptProcessDefinition script ? script : null,
7385
Shell = process is ShellProcessDefinition shell ? shell : null,
74-
Workflow = process is WorkflowProcessDefinition workflow ? workflow : null
86+
Workflow = process is WorkflowProcessDefinition workflow ? workflow : null,
87+
Await = this.AwaitProcess
7588
}
7689
});
7790
}

src/ServerlessWorkflow.Sdk.Builders/ServerlessWorkflow.Sdk.Builders.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<VersionPrefix>1.0.0</VersionPrefix>
8-
<VersionSuffix>alpha5</VersionSuffix>
8+
<VersionSuffix>alpha5.1</VersionSuffix>
99
<AssemblyVersion>$(VersionPrefix)</AssemblyVersion>
1010
<FileVersion>$(VersionPrefix)</FileVersion>
1111
<NeutralLanguage>en</NeutralLanguage>

src/ServerlessWorkflow.Sdk.IO/ServerlessWorkflow.Sdk.IO.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<VersionPrefix>1.0.0</VersionPrefix>
8-
<VersionSuffix>alpha5</VersionSuffix>
8+
<VersionSuffix>alpha5.1</VersionSuffix>
99
<AssemblyVersion>$(VersionPrefix)</AssemblyVersion>
1010
<FileVersion>$(VersionPrefix)</FileVersion>
1111
<NeutralLanguage>en</NeutralLanguage>

src/ServerlessWorkflow.Sdk/Models/ProcessTypeDefinition.cs

+6
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ public record ProcessTypeDefinition
4646
[DataMember(Name = "workflow", Order = 4), JsonPropertyName("workflow"), JsonPropertyOrder(4), YamlMember(Alias = "workflow", Order = 4)]
4747
public virtual WorkflowProcessDefinition? Workflow { get; set; }
4848

49+
/// <summary>
50+
/// Gets/sets a boolean indicating whether or not to await the process completion before continuing. Defaults to 'true'.
51+
/// </summary>
52+
[DataMember(Name = "await", Order = 5), JsonPropertyName("await"), JsonPropertyOrder(5), YamlMember(Alias = "await", Order = 5)]
53+
public virtual bool? Await { get; set; }
54+
4955
/// <summary>
5056
/// Gets the type of the defined process tasks
5157
/// </summary>

src/ServerlessWorkflow.Sdk/ServerlessWorkflow.Sdk.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<VersionPrefix>1.0.0</VersionPrefix>
8-
<VersionSuffix>alpha5</VersionSuffix>
8+
<VersionSuffix>alpha5.1</VersionSuffix>
99
<AssemblyVersion>$(VersionPrefix)</AssemblyVersion>
1010
<FileVersion>$(VersionPrefix)</FileVersion>
1111
<NeutralLanguage>en</NeutralLanguage>

0 commit comments

Comments
 (0)