Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2213,6 +2213,18 @@ public static Consumer<ScheduleBuilder> on(
return DSL.all(filters);
}

/**
* Creates an 'all' event consumption strategy using a specific event type string.
*
* @param eventType the event type
* @return a consumer configuring the event strategy builder
* @see DSL#all(Consumer[])
*/
public static Consumer<AbstractEventConsumptionStrategyBuilder<?, ?, ?>> allOfType(
String eventType) {
return DSL.all(DSL.event().type(eventType));
}
Comment thread
mcruzdev marked this conversation as resolved.
Comment thread
mcruzdev marked this conversation as resolved.

/**
* @see DSL#any(Consumer[])
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package io.serverlessworkflow.fluent.func;

import static io.serverlessworkflow.fluent.func.dsl.FuncDSL.after;
import static io.serverlessworkflow.fluent.func.dsl.FuncDSL.allOfType;
import static io.serverlessworkflow.fluent.func.dsl.FuncDSL.cron;
import static io.serverlessworkflow.fluent.func.dsl.FuncDSL.every;
import static io.serverlessworkflow.fluent.func.dsl.FuncDSL.on;
Expand Down Expand Up @@ -124,4 +125,25 @@ void schedule_on_event_sets_schedule() {
schedule.getOn().getOneEventConsumptionStrategy().getOne().getWith().getType(),
"Event type should match");
}

@Test
@DisplayName(
"schedule(on(allOfType(event))) configures an 'on' schedule with 'all' event consumption strategy")
void schedule_on_allOfType_event_sets_schedule() {
Workflow wf =
FuncWorkflowBuilder.workflow("schedule-on-allOfType-event")
.schedule(on(allOfType("org.acme.processing")))
.build();

Schedule schedule = wf.getSchedule();
assertNotNull(schedule, "Schedule should be configured");
assertNotNull(schedule.getOn(), "On configuration should be set");
assertNotNull(
schedule.getOn().getAllEventConsumptionStrategy(),
"All consumption strategy should be set");
assertEquals(
"org.acme.processing",
schedule.getOn().getAllEventConsumptionStrategy().getAll().get(0).getWith().getType(),
"Event type should match in the filter");
}
}
Loading