Kaynağa Gözat

增加异步事件支持

zhou-hao 4 yıl önce
ebeveyn
işleme
e857247d45

+ 16 - 0
hsweb-core/src/main/java/org/hswebframework/web/event/AsyncEvent.java

@@ -0,0 +1,16 @@
+package org.hswebframework.web.event;
+
+import lombok.Getter;
+import org.reactivestreams.Publisher;
+import reactor.core.publisher.Mono;
+
+@Getter
+public class AsyncEvent {
+
+    private Mono<Void> async = Mono.empty();
+
+    public synchronized void async(Publisher<?> publisher) {
+        this.async = async.then(Mono.from(publisher).then());
+    }
+
+}