public ChangeFeedProcessorHost(MigrationConfig config)
 {
     this.config                 = config;
     SourcePartitionKeys         = config.SourcePartitionKeys;
     TargetPartitionKey          = config.TargetPartitionKey;
     leaseCollectionClient       = new CosmosClient(config.LeaseUri, config.LeaseSecretKey);
     sourceCollectionClient      = new CosmosClient(config.MonitoredUri, config.MonitoredSecretKey);
     destinationCollectionClient = new CosmosClient(config.DestUri, config.DestSecretKey, new CosmosClientOptions()
     {
         AllowBulkExecution = true
     });
 }
        public async Task StartAsync(MigrationConfig config)
        {
            this.config = config;

            Trace.TraceInformation(
                "Starting monitor(source) collection creation: Url {0} - key {1} - dbName {2} - collectionName {3}",
                this.config.MonitoredUri,
                this.config.MonitoredSecretKey,
                this.config.MonitoredDbName,
                this.config.MonitoredCollectionName);

            this.CreateCollectionIfNotExistsAsync(
                this.config.MonitoredUri,
                this.config.MonitoredSecretKey,
                this.config.MonitoredDbName,
                this.config.MonitoredCollectionName,
                this.config.MonitoredThroughput).Wait();

            Trace.TraceInformation(
                "Starting lease (transaction log of change feed) standard collection creation: Url {0} - key {1} - dbName {2} - collectionName {3}",
                this.config.LeaseUri,
                this.config.LeaseSecretKey,
                this.config.LeaseDbName,
                this.config.LeaseCollectionName);

            this.CreateCollectionIfNotExistsAsync(
                this.config.LeaseUri,
                this.config.LeaseSecretKey,
                this.config.LeaseDbName,
                this.config.LeaseCollectionName,
                this.config.LeaseThroughput).Wait();

            Trace.TraceInformation(
                "Starting destination (sink) collection creation: Url {0} - key {1} - dbName {2} - collectionName {3}",
                this.config.DestUri,
                this.config.DestSecretKey,
                this.config.DestDbName,
                this.config.DestCollectionName);

            this.CreateCollectionIfNotExistsAsync(
                this.config.DestUri,
                this.config.DestSecretKey,
                this.config.DestDbName,
                this.config.DestCollectionName,
                this.config.DestThroughput).Wait();

            await this.RunChangeFeedHostAsync();
        }
 public ChangeFeedProcessorHost(MigrationConfig config)
 {
     this.config = config;
 }