예제 #1
0
        /// <inheritdoc />
        public EventHubContentLocationEventStore(
            EventHubContentLocationEventStoreConfiguration configuration,
            IContentLocationEventHandler eventHandler,
            string localMachineName,
            CentralStorage centralStorage,
            Interfaces.FileSystem.AbsolutePath workingDirectory)
            : base(configuration, nameof(EventHubContentLocationEventStore), eventHandler, centralStorage, workingDirectory)
        {
            Contract.Requires(configuration.MaxEventProcessingConcurrency >= 1);
            _configuration    = configuration;
            _localMachineName = localMachineName;

            if (configuration.MaxEventProcessingConcurrency > 1)
            {
                _eventProcessingBlocks =
                    Enumerable.Range(1, configuration.MaxEventProcessingConcurrency)
                    .Select(
                        _ =>
                {
                    var serializer = new ContentLocationEventDataSerializer(configuration.SelfCheckSerialization ? ValidationMode.Trace : ValidationMode.Off);
                    return(new ActionBlock <ProcessEventsInput>(
                               t => ProcessEventsCoreAsync(t, serializer),
                               new ExecutionDataflowBlockOptions()
                    {
                        MaxDegreeOfParallelism = 1,
                        BoundedCapacity = configuration.EventProcessingMaxQueueSize,
                    }));
                })
                    .ToArray();
            }
        }
예제 #2
0
 public SlowedEventHubContentLocationEventStore(
     ContentLocationEventStoreConfiguration configuration,
     IContentLocationEventHandler eventHandler,
     string localMachineName,
     CentralStorage centralStorage,
     AbsolutePath workingDirectory)
     : base(configuration, eventHandler, localMachineName, centralStorage, workingDirectory)
 {
     Contract.Requires(configuration is SlowedContentLocationEventStoreConfiguration);
     _configuration = (configuration as SlowedContentLocationEventStoreConfiguration) !;
 }