|
|
@@ -2,11 +2,15 @@ package org.jetlinks.community.standalone.configuration;
|
|
|
|
|
|
import org.jetlinks.community.standalone.configuration.cluster.ClusterDeviceMessageBrokeMessageBroker;
|
|
|
import org.jetlinks.community.standalone.configuration.cluster.ClusterDeviceMessageConnector;
|
|
|
+import org.jetlinks.community.standalone.configuration.cluster.ruleEngine.ClusterRuleEngine;
|
|
|
import org.jetlinks.core.cluster.ClusterManager;
|
|
|
import org.jetlinks.core.device.DeviceRegistry;
|
|
|
import org.jetlinks.core.event.EventBus;
|
|
|
import org.jetlinks.core.server.MessageHandler;
|
|
|
import org.jetlinks.core.server.session.DeviceSessionManager;
|
|
|
+import org.jetlinks.rule.engine.api.RuleEngine;
|
|
|
+import org.jetlinks.rule.engine.api.scheduler.Scheduler;
|
|
|
+import org.jetlinks.rule.engine.defaults.DefaultRuleEngine;
|
|
|
import org.jetlinks.supports.config.ClusterConfigStorageManager;
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
@@ -24,13 +28,11 @@ import org.springframework.context.annotation.Configuration;
|
|
|
public class ClusterConfiguration {
|
|
|
|
|
|
@Bean
|
|
|
- @ConditionalOnProperty(name = "jetlinks.cluster",havingValue = "true")
|
|
|
public ClusterDeviceMessageBrokeMessageBroker clusterDeviceMessageBrokeMessageBroker(JetLinksProperties properties, ClusterManager clusterManager) {
|
|
|
return new ClusterDeviceMessageBrokeMessageBroker(properties.getServerId(),clusterManager);
|
|
|
}
|
|
|
|
|
|
@Bean
|
|
|
- @ConditionalOnProperty(name = "jetlinks.cluster",havingValue = "true")
|
|
|
public ClusterConfigStorageManager clusterEventBusStorageManager(ClusterManager clusterManager, EventBus eventBus) {
|
|
|
return new ClusterConfigStorageManager(clusterManager);
|
|
|
}
|
|
|
@@ -47,4 +49,10 @@ public class ClusterConfiguration {
|
|
|
return new ClusterDeviceMessageConnector(eventBus, registry, messageHandler, sessionManager,jetLinksProperties.getServerId(),clusterManager);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Bean
|
|
|
+ public RuleEngine defaultRuleEngine(Scheduler scheduler,ClusterManager clusterManager,JetLinksProperties jetLinksProperties) {
|
|
|
+ return new ClusterRuleEngine(scheduler,clusterManager,jetLinksProperties.getServerId());
|
|
|
+ }
|
|
|
+
|
|
|
}
|