/// <summary> /// Initializes a new instance of the <see cref="DocumentDB.ChangeFeedProcessor.ChangeFeedEventHost"/> class. /// </summary> /// <param name="hostName">Unique name for this host.</param> /// <param name="documentCollectionLocation">Specifies location of the DocumentDB collection to monitor changes for.</param> /// <param name="auxCollectionLocation">Specifies location of auxiliary data for load-balancing instances of <see cref="DocumentDB.ChangeFeedProcessor.ChangeFeedEventHost" />.</param> /// <param name="changeFeedOptions">Options to pass to the Microsoft.AzureDocuments.DocumentClient.CreateChangeFeedQuery API.</param> /// <param name="hostOptions">Additional options to control load-balancing of <see cref="DocumentDB.ChangeFeedProcessor.ChangeFeedEventHost" /> instances.</param> public ChangeFeedEventHost( string hostName, DocumentCollectionInfo documentCollectionLocation, DocumentCollectionInfo auxCollectionLocation, ChangeFeedOptions changeFeedOptions, ChangeFeedHostOptions hostOptions) { if (documentCollectionLocation == null) { throw new ArgumentException("documentCollectionLocation"); } if (documentCollectionLocation.Uri == null) { throw new ArgumentException("documentCollectionLocation.Uri"); } if (string.IsNullOrWhiteSpace(documentCollectionLocation.DatabaseName)) { throw new ArgumentException("documentCollectionLocation.DatabaseName"); } if (string.IsNullOrWhiteSpace(documentCollectionLocation.CollectionName)) { throw new ArgumentException("documentCollectionLocation.CollectionName"); } if (hostOptions.MinPartitionCount > hostOptions.MaxPartitionCount) { throw new ArgumentException("hostOptions.MinPartitionCount cannot be greater than hostOptions.MaxPartitionCount"); } this.collectionLocation = CanoninicalizeCollectionInfo(documentCollectionLocation); this.changeFeedOptions = changeFeedOptions; this.options = hostOptions; this.HostName = hostName; this.auxCollectionLocation = CanoninicalizeCollectionInfo(auxCollectionLocation); this.partitionKeyRangeIdToWorkerMap = new ConcurrentDictionary <string, WorkerData>(); }
/// <summary> /// Initializes a new instance of the <see cref="DocumentCollectionInfo"/> class. /// </summary> /// <param name="other">The other <see cref="DocumentCollectionInfo"/> to copy settings from.</param> public DocumentCollectionInfo(DocumentCollectionInfo other) { this.Uri = other.Uri; this.MasterKey = other.MasterKey; this.DatabaseName = other.DatabaseName; this.CollectionName = other.CollectionName; this.ConnectionPolicy = other.ConnectionPolicy; }
static DocumentCollectionInfo CanoninicalizeCollectionInfo(DocumentCollectionInfo collectionInfo) { DocumentCollectionInfo result = collectionInfo; if (string.IsNullOrEmpty(result.ConnectionPolicy.UserAgentSuffix)) { result = new DocumentCollectionInfo(collectionInfo); result.ConnectionPolicy.UserAgentSuffix = DefaultUserAgentSuffix; } return(result); }
/// <summary> /// Initializes a new instance of the <see cref="DocumentDB.ChangeFeedProcessor.ChangeFeedEventHost"/> class. /// </summary> /// <param name="hostName">Unique name for this host.</param> /// <param name="documentCollectionLocation">Specifies location of the DocumentDB collection to monitor changes for.</param> /// <param name="auxCollectionLocation">Specifies location of auxiliary data for load-balancing instances of <see cref="DocumentDB.ChangeFeedProcessor.ChangeFeedEventHost" />.</param> public ChangeFeedEventHost(string hostName, DocumentCollectionInfo documentCollectionLocation, DocumentCollectionInfo auxCollectionLocation) : this(hostName, documentCollectionLocation, auxCollectionLocation, new ChangeFeedOptions(), new ChangeFeedHostOptions()) { }