public CompletableFuture SubscribeToGetNamedShadowAccepted()

in sdk/src/main/java/software/amazon/awssdk/iot/iotshadow/IotShadowClient.java [581:611]


    public CompletableFuture<Integer> SubscribeToGetNamedShadowAccepted(
        GetNamedShadowSubscriptionRequest request,
        QualityOfService qos,
        Consumer<GetShadowResponse> handler,
        Consumer<Exception> exceptionHandler) {
        String topic = "$aws/things/{thingName}/shadow/name/{shadowName}/get/accepted";
        if (request.thingName == null) {
            CompletableFuture<Integer> result = new CompletableFuture<Integer>();
            result.completeExceptionally(new MqttException("GetNamedShadowSubscriptionRequest must have a non-null thingName"));
            return result;
        }
        topic = topic.replace("{thingName}", request.thingName);
        if (request.shadowName == null) {
            CompletableFuture<Integer> result = new CompletableFuture<Integer>();
            result.completeExceptionally(new MqttException("GetNamedShadowSubscriptionRequest must have a non-null shadowName"));
            return result;
        }
        topic = topic.replace("{shadowName}", request.shadowName);
        Consumer<MqttMessage> messageHandler = (message) -> {
            try {
                String payload = new String(message.getPayload(), StandardCharsets.UTF_8);
                GetShadowResponse response = gson.fromJson(payload, GetShadowResponse.class);
                handler.accept(response);
            } catch (Exception e) {
                if (exceptionHandler != null) {
                    exceptionHandler.accept(e);
                }
            }
        };
        return connection.subscribe(topic, qos, messageHandler);
    }