Improved logging of profile updates

This commit is contained in:
Andrii Shvaika 2021-06-25 19:15:07 +03:00
parent 40659a2087
commit c500be4e28

View File

@ -210,7 +210,6 @@ public class DefaultTransportService implements TransportService {
} }
records.forEach(record -> { records.forEach(record -> {
try { try {
log.info("[{}] SessionIdMSB, [{}] SessionIdLSB, records", record.getValue().getSessionIdMSB(), record.getValue().getSessionIdLSB());
processToTransportMsg(record.getValue()); processToTransportMsg(record.getValue());
} catch (Throwable e) { } catch (Throwable e) {
log.warn("Failed to process the notification.", e); log.warn("Failed to process the notification.", e);
@ -771,6 +770,7 @@ public class DefaultTransportService implements TransportService {
UUID sessionId = new UUID(toSessionMsg.getSessionIdMSB(), toSessionMsg.getSessionIdLSB()); UUID sessionId = new UUID(toSessionMsg.getSessionIdMSB(), toSessionMsg.getSessionIdLSB());
SessionMetaData md = sessions.get(sessionId); SessionMetaData md = sessions.get(sessionId);
if (md != null) { if (md != null) {
log.trace("[{}] Processing notification: {}", sessionId, toSessionMsg);
SessionMsgListener listener = md.getListener(); SessionMsgListener listener = md.getListener();
transportCallbackExecutor.submit(() -> { transportCallbackExecutor.submit(() -> {
if (toSessionMsg.hasGetAttributesResponse()) { if (toSessionMsg.hasGetAttributesResponse()) {
@ -798,12 +798,14 @@ public class DefaultTransportService implements TransportService {
deregisterSession(md.getSessionInfo()); deregisterSession(md.getSessionInfo());
} }
} else { } else {
log.trace("Processing broadcast notification: {}", toSessionMsg);
if (toSessionMsg.hasEntityUpdateMsg()) { if (toSessionMsg.hasEntityUpdateMsg()) {
TransportProtos.EntityUpdateMsg msg = toSessionMsg.getEntityUpdateMsg(); TransportProtos.EntityUpdateMsg msg = toSessionMsg.getEntityUpdateMsg();
EntityType entityType = EntityType.valueOf(msg.getEntityType()); EntityType entityType = EntityType.valueOf(msg.getEntityType());
if (EntityType.DEVICE_PROFILE.equals(entityType)) { if (EntityType.DEVICE_PROFILE.equals(entityType)) {
DeviceProfile deviceProfile = deviceProfileCache.put(msg.getData()); DeviceProfile deviceProfile = deviceProfileCache.put(msg.getData());
if (deviceProfile != null) { if (deviceProfile != null) {
log.info("On device profile update: {}", deviceProfile);
onProfileUpdate(deviceProfile); onProfileUpdate(deviceProfile);
} }
} else if (EntityType.TENANT_PROFILE.equals(entityType)) { } else if (EntityType.TENANT_PROFILE.equals(entityType)) {