Commit 5db6a186c46161f418e2f0afd413151ac8f980ff

Authored by Igor Kulikov
2 parents 5174b85a 62230018

Merge branch 'master' of github.com:thingsboard/thingsboard

... ... @@ -32,6 +32,7 @@ import org.thingsboard.server.actors.rpc.RpcManagerActor;
32 32 import org.thingsboard.server.actors.rpc.RpcSessionCreateRequestMsg;
33 33 import org.thingsboard.server.actors.session.SessionManagerActor;
34 34 import org.thingsboard.server.actors.stats.StatsActor;
  35 +import org.thingsboard.server.common.data.Device;
35 36 import org.thingsboard.server.common.data.id.DeviceId;
36 37 import org.thingsboard.server.common.data.id.EntityId;
37 38 import org.thingsboard.server.common.data.id.TenantId;
... ... @@ -48,6 +49,7 @@ import org.thingsboard.server.gen.cluster.ClusterAPIProtos;
48 49 import org.thingsboard.server.service.cluster.discovery.DiscoveryService;
49 50 import org.thingsboard.server.service.cluster.discovery.ServerInstance;
50 51 import org.thingsboard.server.service.cluster.rpc.ClusterRpcService;
  52 +import org.thingsboard.server.service.state.DeviceStateService;
51 53 import scala.concurrent.Await;
52 54 import scala.concurrent.Future;
53 55 import scala.concurrent.duration.Duration;
... ... @@ -81,6 +83,9 @@ public class DefaultActorService implements ActorService {
81 83 @Autowired
82 84 private DiscoveryService discoveryService;
83 85
  86 + @Autowired
  87 + private DeviceStateService deviceStateService;
  88 +
84 89 private ActorSystem system;
85 90
86 91 private ActorRef appActor;
... ... @@ -199,7 +204,7 @@ public class DefaultActorService implements ActorService {
199 204 public void onReceivedMsg(ServerAddress source, ClusterAPIProtos.ClusterMessage msg) {
200 205 ServerAddress serverAddress = new ServerAddress(source.getHost(), source.getPort());
201 206 log.info("Received msg [{}] from [{}]", msg.getMessageType().name(), serverAddress);
202   - if(log.isDebugEnabled()){
  207 + if (log.isDebugEnabled()) {
203 208 log.info("MSG: ", msg);
204 209 }
205 210 switch (msg.getMessageType()) {
... ... @@ -254,4 +259,8 @@ public class DefaultActorService implements ActorService {
254 259 rpcManagerActor.tell(msg, ActorRef.noSender());
255 260 }
256 261
  262 + @Override
  263 + public void onDeviceAdded(Device device) {
  264 + deviceStateService.onDeviceAdded(device);
  265 + }
257 266 }
... ...
... ... @@ -15,11 +15,13 @@
15 15 */
16 16 package org.thingsboard.server.common.transport;
17 17
18   -import org.thingsboard.server.common.data.security.DeviceCredentialsFilter;
  18 +import org.thingsboard.server.common.data.Device;
19 19 import org.thingsboard.server.common.msg.aware.SessionAwareMsg;
20 20
21 21 public interface SessionMsgProcessor {
22 22
23 23 void process(SessionAwareMsg msg);
24 24
  25 + void onDeviceAdded(Device device);
  26 +
25 27 }
... ...
... ... @@ -67,9 +67,9 @@ public abstract class AbstractCassandraCluster {
67 67 private long initTimeout;
68 68 @Value("${cassandra.init_retry_interval_ms}")
69 69 private long initRetryInterval;
70   - @Value("${cassandra.max_requests_per_connection_local:128}")
  70 + @Value("${cassandra.max_requests_per_connection_local:32768}")
71 71 private int max_requests_local;
72   - @Value("${cassandra.max_requests_per_connection_remote:128}")
  72 + @Value("${cassandra.max_requests_per_connection_remote:32768}")
73 73 private int max_requests_remote;
74 74
75 75 @Autowired
... ...
... ... @@ -130,6 +130,13 @@ public class CoapServerTest {
130 130 }
131 131 }
132 132 }
  133 +
  134 + @Override
  135 + public void onDeviceAdded(Device device) {
  136 +
  137 + }
  138 +
  139 +
133 140 };
134 141 }
135 142
... ...
... ... @@ -92,6 +92,7 @@ public class GatewaySessionCtx {
92 92 device.setType(deviceType);
93 93 device = deviceService.saveDevice(device);
94 94 relationService.saveRelationAsync(new EntityRelation(gateway.getId(), device.getId(), "Created"));
  95 + processor.onDeviceAdded(device);
95 96 }
96 97 GatewayDeviceSessionCtx ctx = new GatewayDeviceSessionCtx(this, device);
97 98 devices.put(deviceName, ctx);
... ...