/// <summary> /// Construct a sink posting to the specified database. /// </summary> /// <param name="couchbaseUriList">A list of a Couchbase database servers.</param> /// <param name="bucketName">The bucket to store batches in.</param> /// <param name="batchPostingLimit">The maximum number of events to post in a single batch.</param> /// <param name="period">The time to wait between checking for event batches.</param> /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param> public CouchbaseSink(string[] couchbaseUriList, string bucketName, int batchPostingLimit, TimeSpan period, IFormatProvider formatProvider) : base(batchPostingLimit, period) { if (couchbaseUriList == null) { throw new ArgumentNullException("couchbaseUriList"); } if (couchbaseUriList.Length == 0) { throw new ArgumentException("couchbaseUriList"); } if (couchbaseUriList[0] == null) { throw new ArgumentNullException("couchbaseUriList"); } if (bucketName == null) { throw new ArgumentNullException("bucketName"); } var config = new global::Couchbase.Configuration.CouchbaseClientConfiguration(); foreach (var uri in couchbaseUriList) { config.Urls.Add(new Uri(uri)); } config.Bucket = bucketName; var cluster = new CouchbaseCluster(config); Bucket bucket; if (!cluster.TryGetBucket(bucketName, out bucket)) { throw new InvalidOperationException("bucket '" + bucketName + "' does not exist"); } _couchbaseClient = new global::Couchbase.CouchbaseClient(config); _formatProvider = formatProvider; }