public void onMessage()

in aws-iot-device-sdk-java/src/main/java/com/amazonaws/services/iot/client/shadow/AwsIotDeviceDeltaListener.java [42:85]


    public void onMessage(AWSIotMessage message) {
        String payload = message.getStringPayload();
        if (payload == null) {
            LOGGER.warning("Received empty delta for device " + device.getThingName());
            return;
        }

        JsonNode rootNode;
        try {
            rootNode = device.getJsonObjectMapper().readTree(payload);
            if (!rootNode.isObject()) {
                throw new IOException();
            }
        } catch (IOException e) {
            LOGGER.warning("Received invalid delta for device " + device.getThingName());
            return;
        }

        if (device.enableVersioning) {
            JsonNode node = rootNode.get("version");
            if (node == null) {
                LOGGER.warning("Missing version field in delta for device " + device.getThingName());
                return;
            }

            long receivedVersion = node.longValue();
            long localVersion = device.getLocalVersion().get();
            if (receivedVersion < localVersion) {
                LOGGER.warning("An old version of delta received for " + device.getThingName() + ", local "
                        + localVersion + ", received " + receivedVersion);
                return;
            }

            device.getLocalVersion().set(receivedVersion);
            LOGGER.info("Local version number updated to " + receivedVersion);
        }

        JsonNode node = rootNode.get("state");
        if (node == null) {
            LOGGER.warning("Missing state field in delta for device " + device.getThingName());
            return;
        }
        device.onShadowUpdate(node.toString());
    }