private void Initialize(ClientConfiguration configuration, string defaultBucket, CouchbaseStorageOptions options) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } if (string.IsNullOrEmpty(defaultBucket)) { throw new ArgumentNullException(nameof(defaultBucket)); } Options = options ?? new CouchbaseStorageOptions(); Options.DefaultBucket = defaultBucket; configuration.Serializer = () => new DocumentDefaultSerializer(); Client = new Cluster(configuration); string indexPrefix = $"IDX_{defaultBucket}"; IBucket bucket = Client.OpenBucket(Options.DefaultBucket); { IBucketManager manager = bucket.CreateManager(bucket.Configuration.Username, bucket.Configuration.Password); manager.CreateN1qlPrimaryIndex($"{indexPrefix}_Primary", false); manager.CreateN1qlIndex($"{indexPrefix}_Type", false, "type"); manager.CreateN1qlIndex($"{indexPrefix}_Id", false, "id"); manager.CreateN1qlIndex($"{indexPrefix}_Expire", false, "expire_on"); manager.CreateN1qlIndex($"{indexPrefix}_Name", false, "name"); } JobQueueProvider provider = new JobQueueProvider(this); QueueProviders = new PersistentJobQueueProviderCollection(provider); }