Commit 0494738b74388f96a63cfdf660f64c2a0d4f9ae9

Authored by Andrew Shvayka
1 parent fbc83a72

Gateway Session ACKs fix

@@ -384,7 +384,7 @@ public class BaseRelationService implements RelationService { @@ -384,7 +384,7 @@ public class BaseRelationService implements RelationService {
384 Set<EntityRelation> children = new HashSet<>(findRelations(rootId, direction).get()); 384 Set<EntityRelation> children = new HashSet<>(findRelations(rootId, direction).get());
385 Set<EntityId> childrenIds = new HashSet<>(); 385 Set<EntityId> childrenIds = new HashSet<>();
386 for (EntityRelation childRelation : children) { 386 for (EntityRelation childRelation : children) {
387 - log.info("Found Relation: {}", childRelation); 387 + log.trace("Found Relation: {}", childRelation);
388 EntityId childId; 388 EntityId childId;
389 if (direction == EntitySearchDirection.FROM) { 389 if (direction == EntitySearchDirection.FROM) {
390 childId = childRelation.getTo(); 390 childId = childRelation.getTo();
@@ -392,9 +392,9 @@ public class BaseRelationService implements RelationService { @@ -392,9 +392,9 @@ public class BaseRelationService implements RelationService {
392 childId = childRelation.getFrom(); 392 childId = childRelation.getFrom();
393 } 393 }
394 if (uniqueMap.putIfAbsent(childId, Boolean.TRUE) == null) { 394 if (uniqueMap.putIfAbsent(childId, Boolean.TRUE) == null) {
395 - log.info("Adding Relation: {}", childId); 395 + log.trace("Adding Relation: {}", childId);
396 if (childrenIds.add(childId)) { 396 if (childrenIds.add(childId)) {
397 - log.info("Added Relation: {}", childId); 397 + log.trace("Added Relation: {}", childId);
398 } 398 }
399 } 399 }
400 } 400 }
@@ -229,6 +229,8 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement @@ -229,6 +229,8 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement
229 } else if (topicName.equals(DEVICE_ATTRIBUTES_RESPONSES_TOPIC)) { 229 } else if (topicName.equals(DEVICE_ATTRIBUTES_RESPONSES_TOPIC)) {
230 deviceSessionCtx.setAllowAttributeResponses(); 230 deviceSessionCtx.setAllowAttributeResponses();
231 grantedQoSList.add(getMinSupportedQos(reqQoS)); 231 grantedQoSList.add(getMinSupportedQos(reqQoS));
  232 + } else if (topicName.equals(GATEWAY_ATTRIBUTES_TOPIC)) {
  233 + grantedQoSList.add(getMinSupportedQos(reqQoS));
232 } else { 234 } else {
233 log.warn("[{}] Failed to subscribe to [{}][{}]", sessionId, topicName, reqQoS); 235 log.warn("[{}] Failed to subscribe to [{}][{}]", sessionId, topicName, reqQoS);
234 grantedQoSList.add(FAILURE.value()); 236 grantedQoSList.add(FAILURE.value());
@@ -183,8 +183,8 @@ public class GatewaySessionCtx { @@ -183,8 +183,8 @@ public class GatewaySessionCtx {
183 } 183 }
184 } 184 }
185 185
186 - public void onDeviceAttributesRequest(MqttPublishMessage mqttMsg) throws AdaptorException {  
187 - JsonElement json = validateJsonPayload(gatewaySessionId, mqttMsg.payload()); 186 + public void onDeviceAttributesRequest(MqttPublishMessage msg) throws AdaptorException {
  187 + JsonElement json = validateJsonPayload(gatewaySessionId, msg.payload());
188 if (json.isJsonObject()) { 188 if (json.isJsonObject()) {
189 JsonObject jsonObj = json.getAsJsonObject(); 189 JsonObject jsonObj = json.getAsJsonObject();
190 int requestId = jsonObj.get("id").getAsInt(); 190 int requestId = jsonObj.get("id").getAsInt();
@@ -210,6 +210,7 @@ public class GatewaySessionCtx { @@ -210,6 +210,7 @@ public class GatewaySessionCtx {
210 GatewayDeviceSessionCtx deviceSessionCtx = devices.get(deviceName); 210 GatewayDeviceSessionCtx deviceSessionCtx = devices.get(deviceName);
211 processor.process(new BasicToDeviceActorSessionMsg(deviceSessionCtx.getDevice(), 211 processor.process(new BasicToDeviceActorSessionMsg(deviceSessionCtx.getDevice(),
212 new BasicAdaptorToSessionActorMsg(deviceSessionCtx, request))); 212 new BasicAdaptorToSessionActorMsg(deviceSessionCtx, request)));
  213 + ack(msg);
213 } else { 214 } else {
214 throw new JsonSyntaxException(CAN_T_PARSE_VALUE + json); 215 throw new JsonSyntaxException(CAN_T_PARSE_VALUE + json);
215 } 216 }