Skip to content

Commit 95e0411

Browse files
committed
[Fix #844] Allow disable life cycle events per publisher
Signed-off-by: fjtirado <[email protected]>
1 parent 38e5bee commit 95e0411

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

impl/core/src/main/java/io/serverlessworkflow/impl/events/EventPublisher.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,9 @@
2020

2121
public interface EventPublisher extends AutoCloseable {
2222
CompletableFuture<Void> publish(CloudEvent event);
23+
24+
/*If published decide to ignore life cycle events, override this method and leave it empty*/
25+
default void publishLifeCycle(CloudEvent event) {
26+
publish(event);
27+
}
2328
}

impl/core/src/main/java/io/serverlessworkflow/impl/lifecycle/ce/AbstractLifeCyclePublisher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ protected <T extends WorkflowEvent> void publish(T ev, Function<T, CloudEvent> c
328328
* using application event publishers. That might be changed if needed by children by overriding this method
329329
*/
330330
protected void publish(WorkflowApplication application, CloudEvent ce) {
331-
application.eventPublishers().forEach(p -> p.publish(ce));
331+
application.eventPublishers().forEach(p -> p.publishLifeCycle(ce));
332332
}
333333

334334
private static <T> CloudEventData cloudEventData(T data, ToBytes<T> toBytes) {

0 commit comments

Comments
 (0)