Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Remove all left overs of RULE_EVENT (#2102)

Eric Bariaux8d64ea20ac83
diff --git a/balena/manager.Dockerfile b/balena/manager.Dockerfile
index 9bfc48fa0..c17ab42bc 100644
--- a/balena/manager.Dockerfile
+++ b/balena/manager.Dockerfile
@@ -50,7 +50,6 @@ ENV OR_MAP_SETTINGS_PATH ${OR_MAP_SETTINGS_PATH:-/deployment/map/mapsettings.jso
ENV OR_MAP_TILESERVER_HOST ${OR_MAP_TILESERVER_HOST}
ENV OR_MAP_TILESERVER_PORT ${OR_MAP_TILESERVER_PORT:-8082}
ENV OR_MAP_TILESERVER_REQUEST_TIMEOUT ${OR_MAP_TILESERVER_REQUEST_TIMEOUT:-10000}
-ENV OR_RULE_EVENT_EXPIRES ${OR_RULE_EVENT_EXPIRES:-PT1H}
ENV OR_IDENTITY_PROVIDER ${OR_IDENTITY_PROVIDER:-keycloak}
ENV OR_IDENTITY_SESSION_MAX_MINUTES ${OR_IDENTITY_SESSION_MAX_MINUTES:-1440}
ENV OR_IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES ${OR_IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES:-2628000}
diff --git a/kubernetes/manager/templates/deployment.yaml b/kubernetes/manager/templates/deployment.yaml
index 6ca139d7b..d6c37adb5 100644
--- a/kubernetes/manager/templates/deployment.yaml
+++ b/kubernetes/manager/templates/deployment.yaml
@@ -112,9 +112,6 @@ spec:
- name: OR_MAP_SETTINGS_PATH
value: "{{ .Values.or.mapSettingsPath }}"
- - name: OR_RULE_EVENT_EXPIRES
- value: "{{ .Values.or.ruleEventExpires }}"
-
- name: OR_IDENTITY_PROVIDER
value: "{{ .Values.or.identityProvider }}"
- name: OR_IDENTITY_SESSION_MAX_MINUTES
diff --git a/kubernetes/manager/values.yaml b/kubernetes/manager/values.yaml
index b38aeb1c2..b2a4cdecf 100644
--- a/kubernetes/manager/values.yaml
+++ b/kubernetes/manager/values.yaml
@@ -174,11 +174,6 @@ or:
# manager's map, as well as other style details and colours.
mapSettingsPath: /deployment/map/mapsettings.json
- # When asset attributes are enabled for rule events, each value update will be a temporary
- # fact in rules. You can set the global default expiration time span used when no other
- # attribute-level configuration exists. Default is 1 hour.
- ruleEventExpires: "PT1H"
-
# The identity provider implementation to use for managing user identities, roles, and
# access authorization. The default is 'keycloak' which requires a separate service but
# provides full multi-tenancy identity, role permissions, and user session timeouts.
diff --git a/manager/Dockerfile b/manager/Dockerfile
index 8712b7ab4..5fe0188f8 100644
--- a/manager/Dockerfile
+++ b/manager/Dockerfile
@@ -127,9 +127,6 @@ ENV OR_MAP_TILESERVER_PORT=${OR_MAP_TILESERVER_PORT}
ARG OR_MAP_TILESERVER_REQUEST_TIMEOUT=10000
ENV OR_MAP_TILESERVER_REQUEST_TIMEOUT=${OR_MAP_TILESERVER_REQUEST_TIMEOUT}
-ARG OR_RULE_EVENT_EXPIRES=PT1H
-ENV OR_RULE_EVENT_EXPIRES=${OR_RULE_EVENT_EXPIRES}
-
ARG OR_IDENTITY_PROVIDER=keycloak
ENV OR_IDENTITY_PROVIDER=${OR_IDENTITY_PROVIDER}
diff --git a/manager/src/main/java/org/openremote/manager/asset/AssetProcessingService.java b/manager/src/main/java/org/openremote/manager/asset/AssetProcessingService.java
index 50eb09784..f7f4dd353 100644
--- a/manager/src/main/java/org/openremote/manager/asset/AssetProcessingService.java
+++ b/manager/src/main/java/org/openremote/manager/asset/AssetProcessingService.java
@@ -67,7 +67,7 @@ import static org.openremote.model.attribute.AttributeWriteFailure.*;
* <p>
* <h2>Rules Service processing logic</h2>
* <p>
- * Checks if attribute has {@link MetaItemType#RULE_STATE} and/or {@link MetaItemType#RULE_EVENT} {@link MetaItem}s,
+ * Checks if attribute has {@link MetaItemType#RULE_STATE},
* and if so the message is passed through the rule engines that are in scope for the asset.
* <p>
* <h2>Asset Storage Service processing logic</h2>
diff --git a/manager/src/main/java/org/openremote/manager/rules/RulesFacts.java b/manager/src/main/java/org/openremote/manager/rules/RulesFacts.java
index c71d2d198..b557a29b4 100644
--- a/manager/src/main/java/org/openremote/manager/rules/RulesFacts.java
+++ b/manager/src/main/java/org/openremote/manager/rules/RulesFacts.java
@@ -521,7 +521,7 @@ public class RulesFacts extends Facts implements RuleListener {
if (foundLocationPredicates != null && !foundLocationPredicates.isEmpty()) {
LOG.finest("Location predicate found");
// Collect asset states only where the attribute is location (location predicates only make sense when the location
- // attribute is exposed to rules - we don't support RULE_EVENT facts just RULE_STATE
+ // attribute is exposed to rules)
Collection<AttributeInfo> locationAssetStates = getAssetStates().stream().filter(assetState -> assetState.getName().equalsIgnoreCase(Asset.LOCATION.getName())).collect(Collectors.toSet());
if (assetStateLocationPredicateMap == null) {
diff --git a/manager/src/main/java/org/openremote/manager/rules/RulesService.java b/manager/src/main/java/org/openremote/manager/rules/RulesService.java
index 79a99e270..6a59288f5 100644
--- a/manager/src/main/java/org/openremote/manager/rules/RulesService.java
+++ b/manager/src/main/java/org/openremote/manager/rules/RulesService.java
@@ -55,8 +55,6 @@ import org.openremote.model.rules.geofence.GeofenceDefinition;
import org.openremote.model.security.ClientRole;
import org.openremote.model.security.Realm;
import org.openremote.model.util.Pair;
-import org.openremote.model.util.TextUtil;
-import org.openremote.model.util.TimeUtil;
import org.openremote.model.value.MetaHolder;
import org.openremote.model.value.MetaItemType;
@@ -65,7 +63,6 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.atomic.AtomicReference;
-import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -75,7 +72,6 @@ import static java.util.logging.Level.SEVERE;
import static org.openremote.container.persistence.PersistenceService.PERSISTENCE_TOPIC;
import static org.openremote.container.persistence.PersistenceService.isPersistenceEventForEntityType;
import static org.openremote.container.util.MapAccess.getInteger;
-import static org.openremote.container.util.MapAccess.getString;
import static org.openremote.manager.gateway.GatewayService.isNotForGateway;
/**
@@ -98,8 +94,6 @@ import static org.openremote.manager.gateway.GatewayService.isNotForGateway;
public class RulesService extends RouteBuilder implements ContainerService {
public static final int PRIORITY = LOW_PRIORITY;
- public static final String OR_RULE_EVENT_EXPIRES = "OR_RULE_EVENT_EXPIRES";
- public static final String OR_RULE_EVENT_EXPIRES_DEFAULT = "PT1H";
/**
* This value defines the periodic firing of the rules engines, and therefore
* has an impact on system load. If a temporary fact has a shorter expiration
@@ -141,7 +135,6 @@ public class RulesService extends RouteBuilder implements ContainerService {
// here means we can quickly insert facts into newly started engines
protected final Set<AttributeEvent> attributeEvents = ConcurrentHashMap.newKeySet();
protected final Set<AttributeEvent> preInitAttributeEvents = new HashSet<>();
- protected long defaultEventExpiresMillis = 1000*60*60;
protected long tempFactExpirationMillis;
protected long quickFireMillis;
protected boolean initDone;
@@ -213,15 +206,6 @@ public class RulesService extends RouteBuilder implements ContainerService {
geofenceAssetAdapters.addAll(container.getServices(GeofenceAssetAdapter.class));
geofenceAssetAdapters.sort(Comparator.comparingInt(GeofenceAssetAdapter::getPriority));
container.getService(MessageBrokerService.class).getContext().addRoutes(this);
- String defaultEventExpires = getString(container.getConfig(), OR_RULE_EVENT_EXPIRES, OR_RULE_EVENT_EXPIRES_DEFAULT);
-
- if (!TextUtil.isNullOrEmpty(defaultEventExpires)) {
- try {
- defaultEventExpiresMillis = TimeUtil.parseTimeDuration(defaultEventExpires);
- } catch (RuntimeException exception) {
- LOG.log(Level.WARNING, "Failed to parse " + OR_RULE_EVENT_EXPIRES, exception);
- }
- }
container.getService(ManagerWebService.class).addApiSingleton(
new FlowResourceImpl(
diff --git a/profile/deploy.yml b/profile/deploy.yml
index 1df8b5412..ec3a62b93 100644
--- a/profile/deploy.yml
+++ b/profile/deploy.yml
@@ -298,11 +298,6 @@ services:
# The maximum number of threads that will be used to process incoming auto provisioning messages
OR_AUTO_PROVISIONING_THREADS_MAX:
- # When asset attributes are enabled for rule events, each value update will be a temporary
- # fact in rules. You can set the global default expiration time span used when no other
- # attribute-level configuration exists. Default is 1 hour.
- OR_RULE_EVENT_EXPIRES: ${OR_RULE_EVENT_EXPIRES:-PT1H}
-
# The identity provider implementation to use for managing user identities, roles, and
# access authorization. The default is 'keycloak' which requires a separate service but
# provides full multi-tenancy identity, role permissions, and user session timeouts.