Commit a779839081b92a995afa67427b53bdfefe34dc92

Authored by Andrii Shvaika
1 parent b5bedbfd

Fixed transport

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