thingsboard-aplcache

TB-73: Implementation

7/24/2017 12:47:49 PM

Details

diff --git a/application/src/main/java/org/thingsboard/server/actors/rule/RuleActorMessageProcessor.java b/application/src/main/java/org/thingsboard/server/actors/rule/RuleActorMessageProcessor.java
index 890ef25..5704b12 100644
--- a/application/src/main/java/org/thingsboard/server/actors/rule/RuleActorMessageProcessor.java
+++ b/application/src/main/java/org/thingsboard/server/actors/rule/RuleActorMessageProcessor.java
@@ -174,15 +174,16 @@ class RuleActorMessageProcessor extends ComponentMsgProcessor<RuleId> {
                 context.parent().tell(new RuleToPluginMsgWrapper(pluginTenantId, pluginId, tenantId, entityId, ruleToPluginMsg), context.self());
                 if (action.isOneWayAction()) {
                     pushToNextRule(context, msg.getCtx(), RuleEngineError.NO_TWO_WAY_ACTIONS);
+                    return;
                 } else {
                     pendingMsgMap.put(ruleToPluginMsg.getUid(), msg);
                     scheduleMsgWithDelay(context, new RuleToPluginTimeoutMsg(ruleToPluginMsg.getUid()), systemContext.getPluginProcessingTimeout());
+                    return;
                 }
             }
-        } else {
-            logger.debug("[{}] Nothing to send to plugin: {}", entityId, pluginId);
-            pushToNextRule(context, msg.getCtx(), RuleEngineError.NO_TWO_WAY_ACTIONS);
         }
+        logger.debug("[{}] Nothing to send to plugin: {}", entityId, pluginId);
+        pushToNextRule(context, msg.getCtx(), RuleEngineError.NO_TWO_WAY_ACTIONS);
     }
 
     void onPluginMsg(ActorContext context, PluginToRuleMsg<?> msg) {
@@ -215,13 +216,13 @@ class RuleActorMessageProcessor extends ComponentMsgProcessor<RuleId> {
             ctx = ctx.withError(error);
         }
         if (ctx.isFailure()) {
-            logger.debug("[{}] Forwarding processing chain to device actor due to failure.", ctx.getInMsg().getDeviceId());
+            logger.debug("[{}][{}] Forwarding processing chain to device actor due to failure.", ruleMd.getId(), ctx.getInMsg().getDeviceId());
             ctx.getDeviceActor().tell(new RulesProcessedMsg(ctx), ActorRef.noSender());
         } else if (!ctx.hasNext()) {
-            logger.debug("[{}] Forwarding processing chain to device actor due to end of chain.", ctx.getInMsg().getDeviceId());
+            logger.debug("[{}][{}] Forwarding processing chain to device actor due to end of chain.", ruleMd.getId(), ctx.getInMsg().getDeviceId());
             ctx.getDeviceActor().tell(new RulesProcessedMsg(ctx), ActorRef.noSender());
         } else {
-            logger.debug("[{}] Forwarding processing chain to next rule actor.", ctx.getInMsg().getDeviceId());
+            logger.debug("[{}][{}] Forwarding processing chain to next rule actor.", ruleMd.getId(), ctx.getInMsg().getDeviceId());
             ChainProcessingContext nextTask = ctx.getNext();
             nextTask.getCurrentActor().tell(new RuleProcessingMsg(nextTask), context.self());
         }
diff --git a/application/src/main/resources/logback.xml b/application/src/main/resources/logback.xml
index 93ed505..7169894 100644
--- a/application/src/main/resources/logback.xml
+++ b/application/src/main/resources/logback.xml
@@ -25,7 +25,7 @@
         </encoder>
     </appender>
 
-    <logger name="org.thingsboard.server" level="INFO" />
+    <logger name="org.thingsboard.server" level="TRACE" />
     <logger name="akka" level="INFO" />
 
     <root level="INFO">
diff --git a/extensions-core/src/main/java/org/thingsboard/server/extensions/core/processor/AlarmProcessor.java b/extensions-core/src/main/java/org/thingsboard/server/extensions/core/processor/AlarmProcessor.java
index 3dec45e..e88247a 100644
--- a/extensions-core/src/main/java/org/thingsboard/server/extensions/core/processor/AlarmProcessor.java
+++ b/extensions-core/src/main/java/org/thingsboard/server/extensions/core/processor/AlarmProcessor.java
@@ -125,10 +125,10 @@ public class AlarmProcessor implements RuleProcessor<AlarmProcessorConfiguration
             Alarm alarm = buildAlarm(ctx, msg);
             existing = ctx.createOrUpdateAlarm(alarm);
             if (existing.getStartTs() == alarm.getStartTs()) {
-                log.debug("[{}][{}] New Active Alarm detected");
+                log.debug("[{}][{}] New Active Alarm detected", ctx.getRuleId(), existing.getId());
                 md.put(IS_NEW_ALARM, Boolean.TRUE);
             } else {
-                log.debug("[{}][{}] Existing Active Alarm detected");
+                log.debug("[{}][{}] Existing Active Alarm detected", ctx.getRuleId(), existing.getId());
                 md.put(IS_EXISTING_ALARM, Boolean.TRUE);
             }
         } else if (isClearedAlarm) {