in aws-iot-device-sdk-java/src/main/java/com/amazonaws/services/iot/client/shadow/AwsIotDeviceCommandManager.java [188:225]
public void onSubscriptionAck(String topic, boolean success) {
boolean ready = false;
Command command = getCommandFromTopic(topic);
if (command == null) {
return;
}
String accepted = getTopic(command, CommandAck.ACCEPTED);
String rejected = getTopic(command, CommandAck.REJECTED);
if (accepted.equals(topic) || rejected.equals(topic)) {
if (success && device.isTopicReady(accepted) && device.isTopicReady(rejected)) {
ready = true;
}
}
Iterator<Entry<String, AwsIotDeviceCommand>> it = pendingCommands.entrySet().iterator();
while (it.hasNext()) {
Entry<String, AwsIotDeviceCommand> entry = it.next();
AwsIotDeviceCommand deviceCommand = entry.getValue();
boolean failCommand = false;
if (command.equals(deviceCommand.getCommand())) {
if (ready) {
if (!deviceCommand.onReady(device)) {
failCommand = true;
}
} else if (!success) {
failCommand = true;
}
}
if (failCommand) {
it.remove();
deviceCommand.onFailure();
}
}
}