public static <T extends ConfigInstance> ConfigSubscription<T> get(ConfigKey<T> key, JrtConfigRequesters requesters,
                                                                       ConfigSource source, TimingValues timingValues) {
        String configId = key.getConfigId();
        if (source instanceof RawSource || configId.startsWith("raw:")) return getRawSub(key, source);
        if (source instanceof FileSource || configId.startsWith("file:")) return getFileSub(key, source);
        if (source instanceof DirSource || configId.startsWith("dir:")) return getDirFileSub(key, source);
        if (source instanceof JarSource || configId.startsWith("jar:")) return getJarSub(key, source);
        if (source instanceof ConfigSet cset) return new ConfigSetSubscription<>(key, cset);
        if (source instanceof ConfigSourceSet csset) {
            return new JRTConfigSubscription<>(key, requesters.getRequester(csset, timingValues), timingValues);
        }
        throw new IllegalArgumentException("Unknown source type: " + source);
    }
Correct type of ConfigSubscription instance based on type of source or form of config id

@param key        a {@link ConfigKey}
@return a subclass of a ConfigsSubscription
config/src/main/java/com/yahoo/config/subscription/impl/ConfigSubscription.java