|
18 | 18 | import com.fasterxml.jackson.databind.JsonNode; |
19 | 19 | import com.fasterxml.jackson.databind.node.ArrayNode; |
20 | 20 | import io.cloudevents.CloudEvent; |
| 21 | +import io.serverlessworkflow.api.types.AnyEventConsumptionStrategy; |
21 | 22 | import io.serverlessworkflow.api.types.EventFilter; |
22 | 23 | import io.serverlessworkflow.api.types.ListenTask; |
23 | 24 | import io.serverlessworkflow.api.types.ListenTaskConfiguration; |
24 | 25 | import io.serverlessworkflow.api.types.ListenTaskConfiguration.ListenAndReadAs; |
25 | 26 | import io.serverlessworkflow.api.types.ListenTo; |
26 | 27 | import io.serverlessworkflow.api.types.SubscriptionIterator; |
| 28 | +import io.serverlessworkflow.api.types.Until; |
27 | 29 | import io.serverlessworkflow.api.types.Workflow; |
28 | 30 | import io.serverlessworkflow.impl.TaskContext; |
29 | 31 | import io.serverlessworkflow.impl.WorkflowApplication; |
30 | 32 | import io.serverlessworkflow.impl.WorkflowContext; |
31 | 33 | import io.serverlessworkflow.impl.WorkflowFilter; |
32 | 34 | import io.serverlessworkflow.impl.WorkflowPosition; |
| 35 | +import io.serverlessworkflow.impl.WorkflowUtils; |
33 | 36 | import io.serverlessworkflow.impl.events.CloudEventUtils; |
34 | 37 | import io.serverlessworkflow.impl.events.EventRegistration; |
35 | 38 | import io.serverlessworkflow.impl.events.EventRegistrationBuilder; |
@@ -72,9 +75,18 @@ protected ListenExecutorBuilder( |
72 | 75 | isAnd = true; |
73 | 76 | registrations = from(to.getAllEventConsumptionStrategy().getAll()); |
74 | 77 | } else if (to.getAnyEventConsumptionStrategy() != null) { |
| 78 | + AnyEventConsumptionStrategy any = to.getAnyEventConsumptionStrategy(); |
75 | 79 | isAnd = false; |
76 | | - List<EventFilter> eventFilters = to.getAnyEventConsumptionStrategy().getAny(); |
| 80 | + List<EventFilter> eventFilters = any.getAny(); |
77 | 81 | registrations = eventFilters.isEmpty() ? registerToAll() : from(eventFilters); |
| 82 | + Until untilDesc = any.getUntil(); |
| 83 | + if (untilDesc != null) { |
| 84 | + if (untilDesc.getAnyEventUntilCondition() != null) { |
| 85 | + until = |
| 86 | + WorkflowUtils.buildWorkflowFilter( |
| 87 | + application.expressionFactory(), untilDesc.getAnyEventUntilCondition()); |
| 88 | + } |
| 89 | + } |
78 | 90 | } else if (to.getOneEventConsumptionStrategy() != null) { |
79 | 91 | isAnd = false; |
80 | 92 | registrations = List.of(from(to.getOneEventConsumptionStrategy().getOne())); |
|
0 commit comments