Merge branch 'master' of github.com:thingsboard/thingsboard
This commit is contained in:
commit
5db6a186c4
@ -32,6 +32,7 @@ import org.thingsboard.server.actors.rpc.RpcManagerActor;
|
||||
import org.thingsboard.server.actors.rpc.RpcSessionCreateRequestMsg;
|
||||
import org.thingsboard.server.actors.session.SessionManagerActor;
|
||||
import org.thingsboard.server.actors.stats.StatsActor;
|
||||
import org.thingsboard.server.common.data.Device;
|
||||
import org.thingsboard.server.common.data.id.DeviceId;
|
||||
import org.thingsboard.server.common.data.id.EntityId;
|
||||
import org.thingsboard.server.common.data.id.TenantId;
|
||||
@ -48,6 +49,7 @@ import org.thingsboard.server.gen.cluster.ClusterAPIProtos;
|
||||
import org.thingsboard.server.service.cluster.discovery.DiscoveryService;
|
||||
import org.thingsboard.server.service.cluster.discovery.ServerInstance;
|
||||
import org.thingsboard.server.service.cluster.rpc.ClusterRpcService;
|
||||
import org.thingsboard.server.service.state.DeviceStateService;
|
||||
import scala.concurrent.Await;
|
||||
import scala.concurrent.Future;
|
||||
import scala.concurrent.duration.Duration;
|
||||
@ -81,6 +83,9 @@ public class DefaultActorService implements ActorService {
|
||||
@Autowired
|
||||
private DiscoveryService discoveryService;
|
||||
|
||||
@Autowired
|
||||
private DeviceStateService deviceStateService;
|
||||
|
||||
private ActorSystem system;
|
||||
|
||||
private ActorRef appActor;
|
||||
@ -199,7 +204,7 @@ public class DefaultActorService implements ActorService {
|
||||
public void onReceivedMsg(ServerAddress source, ClusterAPIProtos.ClusterMessage msg) {
|
||||
ServerAddress serverAddress = new ServerAddress(source.getHost(), source.getPort());
|
||||
log.info("Received msg [{}] from [{}]", msg.getMessageType().name(), serverAddress);
|
||||
if(log.isDebugEnabled()){
|
||||
if (log.isDebugEnabled()) {
|
||||
log.info("MSG: ", msg);
|
||||
}
|
||||
switch (msg.getMessageType()) {
|
||||
@ -254,4 +259,8 @@ public class DefaultActorService implements ActorService {
|
||||
rpcManagerActor.tell(msg, ActorRef.noSender());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeviceAdded(Device device) {
|
||||
deviceStateService.onDeviceAdded(device);
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,11 +15,13 @@
|
||||
*/
|
||||
package org.thingsboard.server.common.transport;
|
||||
|
||||
import org.thingsboard.server.common.data.security.DeviceCredentialsFilter;
|
||||
import org.thingsboard.server.common.data.Device;
|
||||
import org.thingsboard.server.common.msg.aware.SessionAwareMsg;
|
||||
|
||||
public interface SessionMsgProcessor {
|
||||
|
||||
void process(SessionAwareMsg msg);
|
||||
|
||||
void onDeviceAdded(Device device);
|
||||
|
||||
}
|
||||
|
||||
@ -67,9 +67,9 @@ public abstract class AbstractCassandraCluster {
|
||||
private long initTimeout;
|
||||
@Value("${cassandra.init_retry_interval_ms}")
|
||||
private long initRetryInterval;
|
||||
@Value("${cassandra.max_requests_per_connection_local:128}")
|
||||
@Value("${cassandra.max_requests_per_connection_local:32768}")
|
||||
private int max_requests_local;
|
||||
@Value("${cassandra.max_requests_per_connection_remote:128}")
|
||||
@Value("${cassandra.max_requests_per_connection_remote:32768}")
|
||||
private int max_requests_remote;
|
||||
|
||||
@Autowired
|
||||
|
||||
@ -130,6 +130,13 @@ public class CoapServerTest {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeviceAdded(Device device) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -92,6 +92,7 @@ public class GatewaySessionCtx {
|
||||
device.setType(deviceType);
|
||||
device = deviceService.saveDevice(device);
|
||||
relationService.saveRelationAsync(new EntityRelation(gateway.getId(), device.getId(), "Created"));
|
||||
processor.onDeviceAdded(device);
|
||||
}
|
||||
GatewayDeviceSessionCtx ctx = new GatewayDeviceSessionCtx(this, device);
|
||||
devices.put(deviceName, ctx);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user