Showing
4 changed files
with
16 additions
and
1 deletions
... | ... | @@ -91,4 +91,13 @@ public class DeviceAttributes { |
91 | 91 | } |
92 | 92 | return map; |
93 | 93 | } |
94 | + | |
95 | + @Override | |
96 | + public String toString() { | |
97 | + return "DeviceAttributes{" + | |
98 | + "clientSideAttributesMap=" + clientSideAttributesMap + | |
99 | + ", serverPrivateAttributesMap=" + serverPrivateAttributesMap + | |
100 | + ", serverPublicAttributesMap=" + serverPublicAttributesMap + | |
101 | + '}'; | |
102 | + } | |
94 | 103 | } | ... | ... |
... | ... | @@ -15,6 +15,7 @@ |
15 | 15 | */ |
16 | 16 | package org.thingsboard.server.extensions.core.action.template; |
17 | 17 | |
18 | +import lombok.extern.slf4j.Slf4j; | |
18 | 19 | import org.apache.velocity.Template; |
19 | 20 | import org.apache.velocity.VelocityContext; |
20 | 21 | import org.apache.velocity.runtime.parser.ParseException; |
... | ... | @@ -35,6 +36,7 @@ import java.util.Optional; |
35 | 36 | /** |
36 | 37 | * @author Andrew Shvayka |
37 | 38 | */ |
39 | +@Slf4j | |
38 | 40 | public abstract class AbstractTemplatePluginAction<T extends TemplateActionConfiguration> extends SimpleRuleLifecycleComponent implements PluginAction<T> { |
39 | 41 | protected T configuration; |
40 | 42 | protected Template template; |
... | ... | @@ -69,6 +71,7 @@ public abstract class AbstractTemplatePluginAction<T extends TemplateActionConfi |
69 | 71 | } |
70 | 72 | |
71 | 73 | protected String getMsgBody(RuleContext ctx, ToDeviceActorMsg msg) { |
74 | + log.trace("Creating context for: {} and payload {}", ctx.getDeviceAttributes(), msg.getPayload()); | |
72 | 75 | VelocityContext context = VelocityUtils.createContext(ctx.getDeviceAttributes(), msg.getPayload()); |
73 | 76 | return VelocityUtils.merge(template, context); |
74 | 77 | } | ... | ... |
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | package org.thingsboard.server.extensions.kafka.plugin; |
17 | 17 | |
18 | 18 | import lombok.RequiredArgsConstructor; |
19 | +import lombok.extern.slf4j.Slf4j; | |
19 | 20 | import org.apache.kafka.clients.producer.Producer; |
20 | 21 | import org.apache.kafka.clients.producer.ProducerRecord; |
21 | 22 | import org.thingsboard.server.common.data.id.RuleId; |
... | ... | @@ -30,6 +31,7 @@ import org.thingsboard.server.extensions.kafka.action.KafkaActionMsg; |
30 | 31 | import org.thingsboard.server.extensions.kafka.action.KafkaActionPayload; |
31 | 32 | |
32 | 33 | @RequiredArgsConstructor |
34 | +@Slf4j | |
33 | 35 | public class KafkaMsgHandler implements RuleMsgHandler { |
34 | 36 | |
35 | 37 | private final Producer<?, String> producer; |
... | ... | @@ -40,7 +42,7 @@ public class KafkaMsgHandler implements RuleMsgHandler { |
40 | 42 | throw new RuleException("Unsupported message type " + msg.getClass().getName() + "!"); |
41 | 43 | } |
42 | 44 | KafkaActionPayload payload = ((KafkaActionMsg) msg).getPayload(); |
43 | - | |
45 | + log.debug("Processing kafka payload: {}", payload); | |
44 | 46 | try { |
45 | 47 | producer.send(new ProducerRecord<>(payload.getTopic(), payload.getMsgBody()), |
46 | 48 | (metadata, e) -> { | ... | ... |
... | ... | @@ -78,6 +78,7 @@ public class GatewaySessionCtx { |
78 | 78 | Device newDevice = new Device(); |
79 | 79 | newDevice.setTenantId(gateway.getTenantId()); |
80 | 80 | newDevice.setName(deviceName); |
81 | + newDevice.setType("default"); | |
81 | 82 | return deviceService.saveDevice(newDevice); |
82 | 83 | }); |
83 | 84 | GatewayDeviceSessionCtx ctx = new GatewayDeviceSessionCtx(this, device); | ... | ... |