Commit a779839081b92a995afa67427b53bdfefe34dc92

Authored by Andrii Shvaika
1 parent b5bedbfd

Fixed transport

@@ -32,6 +32,7 @@ import lombok.Setter; @@ -32,6 +32,7 @@ import lombok.Setter;
32 import lombok.extern.slf4j.Slf4j; 32 import lombok.extern.slf4j.Slf4j;
33 import org.springframework.beans.factory.annotation.Autowired; 33 import org.springframework.beans.factory.annotation.Autowired;
34 import org.springframework.beans.factory.annotation.Value; 34 import org.springframework.beans.factory.annotation.Value;
  35 +import org.springframework.context.annotation.Lazy;
35 import org.springframework.data.redis.core.RedisTemplate; 36 import org.springframework.data.redis.core.RedisTemplate;
36 import org.springframework.scheduling.annotation.Scheduled; 37 import org.springframework.scheduling.annotation.Scheduled;
37 import org.springframework.stereotype.Component; 38 import org.springframework.stereotype.Component;
@@ -233,6 +234,7 @@ public class ActorSystemContext { @@ -233,6 +234,7 @@ public class ActorSystemContext {
233 /** 234 /**
234 * The following Service will be null if we operate in tb-core mode 235 * The following Service will be null if we operate in tb-core mode
235 */ 236 */
  237 + @Lazy
236 @Autowired(required = false) 238 @Autowired(required = false)
237 @Getter 239 @Getter
238 private TbRuleEngineDeviceRpcService tbRuleEngineDeviceRpcService; 240 private TbRuleEngineDeviceRpcService tbRuleEngineDeviceRpcService;
@@ -240,6 +242,7 @@ public class ActorSystemContext { @@ -240,6 +242,7 @@ public class ActorSystemContext {
240 /** 242 /**
241 * The following Service will be null if we operate in tb-rule-engine mode 243 * The following Service will be null if we operate in tb-rule-engine mode
242 */ 244 */
  245 + @Lazy
243 @Autowired(required = false) 246 @Autowired(required = false)
244 @Getter 247 @Getter
245 private TbCoreDeviceRpcService tbCoreDeviceRpcService; 248 private TbCoreDeviceRpcService tbCoreDeviceRpcService;
@@ -544,6 +544,9 @@ public class DefaultTransportService implements TransportService { @@ -544,6 +544,9 @@ public class DefaultTransportService implements TransportService {
544 544
545 protected void sendToDeviceActor(TransportProtos.SessionInfoProto sessionInfo, TransportToDeviceActorMsg toDeviceActorMsg, TransportServiceCallback<Void> callback) { 545 protected void sendToDeviceActor(TransportProtos.SessionInfoProto sessionInfo, TransportToDeviceActorMsg toDeviceActorMsg, TransportServiceCallback<Void> callback) {
546 TopicPartitionInfo tpi = partitionService.resolve(ServiceType.TB_CORE, getTenantId(sessionInfo), getDeviceId(sessionInfo)); 546 TopicPartitionInfo tpi = partitionService.resolve(ServiceType.TB_CORE, getTenantId(sessionInfo), getDeviceId(sessionInfo));
  547 + if (log.isTraceEnabled()) {
  548 + log.trace("[{}][{}] Pushing to topic {} message {}", getTenantId(sessionInfo), getDeviceId(sessionInfo), tpi.getFullTopicName(), toDeviceActorMsg);
  549 + }
547 tbCoreMsgProducer.send(tpi, 550 tbCoreMsgProducer.send(tpi,
548 new TbProtoQueueMsg<>(getRoutingKey(sessionInfo), 551 new TbProtoQueueMsg<>(getRoutingKey(sessionInfo),
549 ToCoreMsg.newBuilder().setToDeviceActorMsg(toDeviceActorMsg).build()), callback != null ? 552 ToCoreMsg.newBuilder().setToDeviceActorMsg(toDeviceActorMsg).build()), callback != null ?
@@ -552,6 +555,9 @@ public class DefaultTransportService implements TransportService { @@ -552,6 +555,9 @@ public class DefaultTransportService implements TransportService {
552 555
553 protected void sendToRuleEngine(TenantId tenantId, TbMsg tbMsg, TbQueueCallback callback) { 556 protected void sendToRuleEngine(TenantId tenantId, TbMsg tbMsg, TbQueueCallback callback) {
554 TopicPartitionInfo tpi = partitionService.resolve(ServiceType.TB_RULE_ENGINE, tenantId, tbMsg.getOriginator()); 557 TopicPartitionInfo tpi = partitionService.resolve(ServiceType.TB_RULE_ENGINE, tenantId, tbMsg.getOriginator());
  558 + if (log.isTraceEnabled()) {
  559 + log.trace("[{}][{}] Pushing to topic {} message {}", tenantId, tbMsg.getOriginator(), tpi.getFullTopicName(), tbMsg);
  560 + }
555 ToRuleEngineMsg msg = ToRuleEngineMsg.newBuilder().setTbMsg(TbMsg.toByteString(tbMsg)) 561 ToRuleEngineMsg msg = ToRuleEngineMsg.newBuilder().setTbMsg(TbMsg.toByteString(tbMsg))
556 .setTenantIdMSB(tenantId.getId().getMostSignificantBits()) 562 .setTenantIdMSB(tenantId.getId().getMostSignificantBits())
557 .setTenantIdLSB(tenantId.getId().getLeastSignificantBits()).build(); 563 .setTenantIdLSB(tenantId.getId().getLeastSignificantBits()).build();
  1 +ZOOKEEPER_ENABLED=true
  2 +ZOOKEEPER_URL=zookeeper:2181
1 3
2 COAP_BIND_ADDRESS=0.0.0.0 4 COAP_BIND_ADDRESS=0.0.0.0
3 COAP_BIND_PORT=5683 5 COAP_BIND_PORT=5683
  1 +ZOOKEEPER_ENABLED=true
  2 +ZOOKEEPER_URL=zookeeper:2181
1 3
2 HTTP_BIND_ADDRESS=0.0.0.0 4 HTTP_BIND_ADDRESS=0.0.0.0
3 HTTP_BIND_PORT=8081 5 HTTP_BIND_PORT=8081
  1 +ZOOKEEPER_ENABLED=true
  2 +ZOOKEEPER_URL=zookeeper:2181
1 3
2 MQTT_BIND_ADDRESS=0.0.0.0 4 MQTT_BIND_ADDRESS=0.0.0.0
3 MQTT_BIND_PORT=1883 5 MQTT_BIND_PORT=1883