Search in sources :

Example 1 with ConsulContext

use of com.couchbase.connector.cluster.consul.ConsulContext in project couchbase-elasticsearch-connector by couchbase.

the class PauseCommand method run.

@Override
public void run() {
    final ConsulContext ctx = new ConsulContext(consulBuilder(), group, null);
    validateGroup(ctx);
    final Consul consul = ctx.consul();
    final String configKey = ctx.keys().config();
    final String configString = consul.keyValueClient().getValueAsString(configKey, UTF_8).orElse(null);
    if (Strings.isNullOrEmpty(configString)) {
        System.err.println("ERROR: Connector configuration document does not exist, or is empty.");
        System.exit(1);
    }
    final ConnectorConfig config = ConnectorConfig.from(configString);
    try {
        CheckpointBackup.backup(config, output);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : ConnectorConfig(com.couchbase.connector.config.es.ConnectorConfig) IOException(java.io.IOException) Consul(com.orbitz.consul.Consul) ConsulContext(com.couchbase.connector.cluster.consul.ConsulContext)

Aggregations

ConsulContext (com.couchbase.connector.cluster.consul.ConsulContext)1 ConnectorConfig (com.couchbase.connector.config.es.ConnectorConfig)1 Consul (com.orbitz.consul.Consul)1 IOException (java.io.IOException)1