Search in sources :

Example 1 with CouchbaseSourceConfig

use of com.couchbase.connect.kafka.config.source.CouchbaseSourceConfig in project kafka-connect-couchbase by couchbase.

the class CouchbaseSourceConnector method start.

@Override
public void start(Map<String, String> properties) {
    try {
        configProperties = properties;
        CouchbaseSourceConfig config = ConfigHelper.parse(CouchbaseSourceConfig.class, properties);
        try (KafkaCouchbaseClient client = new KafkaCouchbaseClient(config)) {
            Bucket bucket = client.bucket();
            bucketConfig = (CouchbaseBucketConfig) CouchbaseHelper.getConfig(bucket, config.bootstrapTimeout());
            String connectionString = String.join(",", config.seedNodes());
            NetworkResolution network = NetworkResolution.valueOf(config.network());
            seedNodes = SeedNodeHelper.getKvNodes(bucket, connectionString, config.enableTls(), network, config.bootstrapTimeout());
        }
    } catch (ConfigException e) {
        throw new ConnectException("Cannot start CouchbaseSourceConnector due to configuration error", e);
    }
}
Also used : NetworkResolution(com.couchbase.client.core.env.NetworkResolution) Bucket(com.couchbase.client.java.Bucket) ConfigException(org.apache.kafka.common.config.ConfigException) CouchbaseSourceConfig(com.couchbase.connect.kafka.config.source.CouchbaseSourceConfig) ConnectException(org.apache.kafka.connect.errors.ConnectException)

Aggregations

NetworkResolution (com.couchbase.client.core.env.NetworkResolution)1 Bucket (com.couchbase.client.java.Bucket)1 CouchbaseSourceConfig (com.couchbase.connect.kafka.config.source.CouchbaseSourceConfig)1 ConfigException (org.apache.kafka.common.config.ConfigException)1 ConnectException (org.apache.kafka.connect.errors.ConnectException)1