Skip to content

Commit 67dbde0

Browse files
committed
feat(Sdk): Add a new until property to the listen task, used to configure the condition or consumption strategy that defines when to stop listening for incoming events
Signed-off-by: Charles d'Avernas <[email protected]>
1 parent 5ac04f1 commit 67dbde0

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

src/ServerlessWorkflow.Sdk/Models/EventConsumptionStrategyDefinition.cs

+28-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public record EventConsumptionStrategyDefinition
2727
public virtual EquatableList<EventFilterDefinition>? All { get; set; }
2828

2929
/// <summary>
30-
/// Gets/sets a list containing any of the events to consume, if any
30+
/// Gets/sets a list containing any of the events to consume, if any.<para></para>
31+
/// If empty, listens to all incoming events, and requires <see cref="Until"/> to be set.
3132
/// </summary>
3233
[DataMember(Name = "any", Order = 2), JsonPropertyName("any"), JsonPropertyOrder(2), YamlMember(Alias = "any", Order = 2)]
3334
public virtual EquatableList<EventFilterDefinition>? Any { get; set; }
@@ -38,4 +39,30 @@ public record EventConsumptionStrategyDefinition
3839
[DataMember(Name = "one", Order = 3), JsonPropertyName("one"), JsonPropertyOrder(3), YamlMember(Alias = "one", Order = 3)]
3940
public virtual EventFilterDefinition? One { get; set; }
4041

42+
/// <summary>
43+
/// Gets/sets the condition or the consumption strategy that defines the events that must be consumed to stop listening
44+
/// </summary>
45+
[DataMember(Name = "until", Order = 4), JsonInclude, JsonPropertyName("until"), JsonPropertyOrder(4), YamlMember(Alias = "until", Order = 4)]
46+
protected virtual OneOf<EventConsumptionStrategyDefinition, string>? UntilValue { get; set; }
47+
48+
/// <summary>
49+
/// Gets/sets the consumption strategy, if any, that defines the events that must be consumed to stop listening
50+
/// </summary>
51+
[IgnoreDataMember, JsonIgnore, YamlIgnore]
52+
public virtual EventConsumptionStrategyDefinition? Until
53+
{
54+
get => this.UntilValue?.T1Value;
55+
set => this.UntilValue = value!;
56+
}
57+
58+
/// <summary>
59+
/// Gets/sets a runtime expression, if any, that represents the condition that must be met to stop listening
60+
/// </summary>
61+
[IgnoreDataMember, JsonIgnore, YamlIgnore]
62+
public virtual string? UntilExpression
63+
{
64+
get => this.UntilValue?.T2Value;
65+
set => this.UntilValue = value!;
66+
}
67+
4168
}

0 commit comments

Comments
 (0)