public void ApplyBuildConfiguration(
            DocumentServiceLeaseStoreManager customDocumentServiceLeaseStoreManager,
            ContainerInternal leaseContainer,
            string monitoredContainerRid,
            string instanceName,
            ChangeFeedLeaseOptions changeFeedLeaseOptions,
            ChangeFeedProcessorOptions changeFeedProcessorOptions,
            ContainerInternal monitoredContainer)
        {
            if (monitoredContainer == null)
            {
                throw new ArgumentNullException(nameof(monitoredContainer));
            }
            if (customDocumentServiceLeaseStoreManager == null && leaseContainer == null)
            {
                throw new ArgumentNullException(nameof(leaseContainer));
            }
            if (instanceName == null)
            {
                throw new ArgumentNullException("InstanceName is required for the processor to initialize.");
            }

            this.documentServiceLeaseStoreManager = customDocumentServiceLeaseStoreManager;
            this.leaseContainer             = leaseContainer;
            this.monitoredContainerRid      = monitoredContainerRid;
            this.instanceName               = instanceName;
            this.changeFeedProcessorOptions = changeFeedProcessorOptions;
            this.changeFeedLeaseOptions     = changeFeedLeaseOptions;
            this.monitoredContainer         = monitoredContainer;
        }
示例#2
0
        public PartitionSupervisorFactoryCore(
            ChangeFeedObserverFactory <T> observerFactory,
            DocumentServiceLeaseManager leaseManager,
            FeedProcessorFactory <T> partitionProcessorFactory,
            ChangeFeedLeaseOptions options)
        {
            if (observerFactory == null)
            {
                throw new ArgumentNullException(nameof(observerFactory));
            }
            if (leaseManager == null)
            {
                throw new ArgumentNullException(nameof(leaseManager));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (partitionProcessorFactory == null)
            {
                throw new ArgumentNullException(nameof(partitionProcessorFactory));
            }

            this.observerFactory           = observerFactory;
            this.leaseManager              = leaseManager;
            this.changeFeedLeaseOptions    = options;
            this.partitionProcessorFactory = partitionProcessorFactory;
        }
        public static string GetLeasePrefix(
            this CosmosContainer monitoredContainer,
            ChangeFeedLeaseOptions changeFeedLeaseOptions,
            string monitoredContainerRid)
        {
            string optionsPrefix = changeFeedLeaseOptions.LeasePrefix ?? string.Empty;

            return(string.Format(
                       CultureInfo.InvariantCulture,
                       "{0}{1}_{2}",
                       optionsPrefix,
                       ((CosmosContainerCore)monitoredContainer).ClientContext.ClientOptions.AccountEndPoint.Host,
                       monitoredContainerRid));
        }
示例#4
0
 internal ChangeFeedProcessorBuilder(
     string processorName,
     ContainerCore container,
     ChangeFeedProcessor changeFeedProcessor,
     Action <DocumentServiceLeaseStoreManager,
             ContainerCore,
             string,
             string,
             ChangeFeedLeaseOptions,
             ChangeFeedProcessorOptions,
             ContainerCore> applyBuilderConfiguration)
 {
     this.changeFeedLeaseOptions             = new ChangeFeedLeaseOptions();
     this.changeFeedLeaseOptions.LeasePrefix = processorName;
     this.monitoredContainer        = container;
     this.changeFeedProcessor       = changeFeedProcessor;
     this.applyBuilderConfiguration = applyBuilderConfiguration;
 }
示例#5
0
        public void ApplyBuildConfiguration(
            DocumentServiceLeaseStoreManager customDocumentServiceLeaseStoreManager,
            ContainerInternal leaseContainer,
            string instanceName,
            ChangeFeedLeaseOptions changeFeedLeaseOptions,
            ChangeFeedProcessorOptions changeFeedProcessorOptions,
            ContainerInternal monitoredContainer)
        {
            if (leaseContainer == null && customDocumentServiceLeaseStoreManager == null)
            {
                throw new ArgumentNullException(nameof(leaseContainer));
            }

            this.leaseContainer                = leaseContainer;
            this.monitoredContainer            = monitoredContainer ?? throw new ArgumentNullException(nameof(monitoredContainer));
            this.changeFeedLeaseOptions        = changeFeedLeaseOptions;
            this.documentServiceLeaseContainer = customDocumentServiceLeaseStoreManager?.LeaseContainer;
        }
        public void ApplyBuildConfiguration(
            DocumentServiceLeaseStoreManager customDocumentServiceLeaseStoreManager,
            CosmosContainer leaseContainer,
            string leaseContainerPrefix,
            string instanceName,
            ChangeFeedLeaseOptions changeFeedLeaseOptions,
            ChangeFeedProcessorOptions changeFeedProcessorOptions,
            CosmosContainer monitoredContainer)
        {
            if (monitoredContainer == null)
            {
                throw new ArgumentNullException(nameof(monitoredContainer));
            }
            if (leaseContainer == null)
            {
                throw new ArgumentNullException(nameof(leaseContainer));
            }

            this.documentServiceLeaseStoreManager = customDocumentServiceLeaseStoreManager;
            this.leaseContainer       = leaseContainer;
            this.leaseContainerPrefix = leaseContainerPrefix;
            this.monitoredContainer   = monitoredContainer;
        }