Search in sources :

Example 1 with KsqlVersion

use of io.confluent.ksql.util.KsqlVersion in project ksql by confluentinc.

the class Cli method checkServerCompatibility.

private static String checkServerCompatibility(final String cliVersionNumber, final String serverVersionNumber) {
    final KsqlVersion cliVersion;
    try {
        cliVersion = new KsqlVersion(cliVersionNumber);
    } catch (final IllegalArgumentException exception) {
        return "\nWARNING: Could not identify CLI version.\n" + "         Non-matching CLI and server versions may lead to unexpected errors.\n\n";
    }
    final KsqlVersion serverVersion;
    try {
        serverVersion = new KsqlVersion(serverVersionNumber);
    } catch (final IllegalArgumentException exception) {
        return "\nWARNING: Could not identify server version.\n" + "         Non-matching CLI and server versions may lead to unexpected errors.\n\n";
    }
    if (!serverVersion.isAtLeast(new KsqlVersion("6.0."))) {
        throw new KsqlUnsupportedServerException(serverVersion.type() == VersionType.CONFLUENT_PLATFORM ? "6.0.0" : "0.10.0", cliVersionNumber, serverVersionNumber);
    }
    if (!cliVersion.same(serverVersion)) {
        return "\nWARNING: CLI and server version don't match. This may lead to unexpected errors.\n" + "         It is recommended to use a CLI that matches the server version.\n\n";
    }
    return NO_WARNING;
}
Also used : KsqlUnsupportedServerException(io.confluent.ksql.rest.client.exception.KsqlUnsupportedServerException) KsqlVersion(io.confluent.ksql.util.KsqlVersion)

Aggregations

KsqlUnsupportedServerException (io.confluent.ksql.rest.client.exception.KsqlUnsupportedServerException)1 KsqlVersion (io.confluent.ksql.util.KsqlVersion)1