@Override
    public CompletableFuture<PlcSubscriptionResponse> subscribe(PlcSubscriptionRequest subscriptionRequest) {
        PlcSubscriptionRequest filteredSubscriptionRequest = getFilteredSubscriptionRequest((DefaultPlcSubscriptionRequest) subscriptionRequest);
        return internalSubscribe(filteredSubscriptionRequest)
            .thenApply(filteredSubscriptionResponse -> {
                // Shortcut for the case that all tags were valid.
                if(subscriptionRequest.getNumberOfTags() == filteredSubscriptionRequest.getNumberOfTags()) {
                    return filteredSubscriptionResponse;
                }

                Map<String, PlcResponseItem<PlcSubscriptionHandle>> values = new HashMap<>();
                for (String tagName : subscriptionRequest.getTagNames()) {
                    // If the tag was correct, then we expect a response in the response.
                    if(filteredSubscriptionRequest.getTagResponseCode(tagName) != null) {
                        values.put(tagName, new DefaultPlcResponseItem<>(filteredSubscriptionRequest.getTagResponseCode(tagName), filteredSubscriptionResponse.getSubscriptionHandle(tagName)));
                    }
                    // In all other cases forward the initial error to the final output.
                    else {
                        values.put(tagName, new DefaultPlcResponseItem<>(subscriptionRequest.getTagResponseCode(tagName), null));
                    }
                }
                return new DefaultPlcSubscriptionResponse(subscriptionRequest, values);
            });
    }
Base class for implementing connections.
Per default, all operations (read, write, subscribe) are unsupported.
Concrete implementations should override the methods indicating connection capabilities
and for obtaining respective request builders.
plc4j/spi/src/main/java/org/apache/plc4x/java/spi/connection/AbstractPlcConnection.java