Forráskód Böngészése

修复Scheduler未注入问题

zhou-hao 5 éve
szülő
commit
656ff23231

+ 2 - 1
jetlinks-components/rule-engine-component/src/main/java/org/jetlinks/community/rule/engine/configuration/RuleEngineConfiguration.java

@@ -73,7 +73,7 @@ public class RuleEngineConfiguration {
     }
 
     @Bean
-    public LocalScheduler clusterLocalScheduler(Worker worker) {
+    public Scheduler localScheduler(Worker worker) {
         LocalScheduler scheduler = new LocalScheduler("local");
         scheduler.addWorker(worker);
         return scheduler;
@@ -122,6 +122,7 @@ public class RuleEngineConfiguration {
         return new LocalWorker("local", "local", eventBus, evaluator);
     }
 
+
     @Bean
     public RuleEngine defaultRuleEngine(Scheduler scheduler) {
         return new DefaultRuleEngine(scheduler);

+ 7 - 0
jetlinks-standalone/src/main/java/org/jetlinks/community/standalone/configuration/ExecutorConfiguration.java

@@ -10,6 +10,8 @@ import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Primary;
 import org.springframework.scheduling.annotation.AsyncConfigurer;
 import org.springframework.scheduling.concurrent.ThreadPoolExecutorFactoryBean;
+import reactor.core.scheduler.Scheduler;
+import reactor.core.scheduler.Schedulers;
 
 import java.util.concurrent.*;
 
@@ -34,6 +36,11 @@ public class ExecutorConfiguration {
         };
     }
 
+    @Bean
+    public Scheduler reactorScheduler(ScheduledExecutorService executorService) {
+        return Schedulers.fromExecutorService(executorService);
+    }
+
     @Bean
     @ConfigurationProperties(prefix = "jetlinks.executor")
     @Primary