Esempio n. 1
0
 public EventHubQueueCacheForTesting(IObjectPool <FixedSizeBuffer> bufferPool, IEventHubDataAdapter dataAdapter, IEvictionStrategy evictionStrategy, IStreamQueueCheckpointer <string> checkpointer,
                                     ILogger logger)
     : base("test", EventHubAdapterReceiver.MaxMessagesPerRead, bufferPool, dataAdapter, evictionStrategy, checkpointer, logger, null, null)
 {
 }
Esempio n. 2
0
 public QueueCacheForTesting(int defaultMaxAddCount, IStreamQueueCheckpointer <string> checkpointer, ICacheDataAdapter <EventData, CachedEventHubMessage> cacheDataAdapter,
                             ICacheDataComparer <CachedEventHubMessage> comparer, ILogger logger, IEvictionStrategy <CachedEventHubMessage> evictionStrategy,
                             ICacheMonitor cacheMonitor, TimeSpan?cacheMonitorWriteInterval)
     : base(defaultMaxAddCount, checkpointer, cacheDataAdapter, comparer, logger, evictionStrategy, cacheMonitor, cacheMonitorWriteInterval)
 {
 }
Esempio n. 3
0
 public DefaultEventHubQueueCache(IStreamQueueCheckpointer <string> checkpointer, IObjectPool <FixedSizeBuffer> bufferPool)
     : base(EventHubAdapterReceiver.MaxMessagesPerRead, checkpointer, new EventHubDataAdapter(bufferPool), EventHubDataComparer.Instance)
 {
 }
Esempio n. 4
0
            protected override IEventHubQueueCache CreateCache(string partition, StreamStatisticOptions options, IStreamQueueCheckpointer <string> checkpointer,
                                                               ILoggerFactory loggerFactory, IObjectPool <FixedSizeBuffer> bufferPool, string blockPoolId, TimePurgePredicate timePurge,
                                                               SerializationManager serializationManager, EventHubMonitorAggregationDimensions sharedDimensions, ITelemetryProducer telemetryProducer)
            {
                var cacheMonitorDimensions = new EventHubCacheMonitorDimensions(sharedDimensions, partition, blockPoolId);
                var cacheMonitor           = this.CacheMonitorFactory(cacheMonitorDimensions, loggerFactory, telemetryProducer);
                var cacheLogger            = loggerFactory.CreateLogger($"{typeof(EventHubQueueCache).FullName}.{this.name}.{partition}");
                //set defaultMaxAddCount to 10 so TryCalculateCachePressureContribution will start to calculate real contribution shortly
                var cache = new QueueCacheForTesting(DefaultMaxAddCount, checkpointer, new EventHubDataAdapter(serializationManager, bufferPool),
                                                     EventHubDataComparer.Instance, cacheLogger, new EventHubCacheEvictionStrategy(cacheLogger, timePurge, cacheMonitor, options.StatisticMonitorWriteInterval),
                                                     cacheMonitor, options.StatisticMonitorWriteInterval);

                this.caches.Add(cache);
                return(cache);
            }
Esempio n. 5
0
 public EventHubQueueCacheForTesting(IStreamQueueCheckpointer <string> checkpointer, ICacheDataAdapter <EventData, CachedEventHubMessage> cacheDataAdapter,
                                     ICacheDataComparer <CachedEventHubMessage> comparer, Logger logger, IEvictionStrategy <CachedEventHubMessage> evictionStrategy)
     : base(checkpointer, cacheDataAdapter, comparer, logger, evictionStrategy, null, null)
 {
 }
        /// <summary>
        /// Default function to be called to create an EventhubQueueCache in IEventHubQueueCacheFactory.CreateCache method. User can
        /// override this method to add more customization.
        /// </summary>
        protected virtual IEventHubQueueCache CreateCache(string partition, StreamStatisticOptions statisticOptions, IStreamQueueCheckpointer <string> checkpointer,
                                                          ILoggerFactory loggerFactory, IObjectPool <FixedSizeBuffer> bufferPool, string blockPoolId, TimePurgePredicate timePurge,
                                                          SerializationManager serializationManager, EventHubMonitorAggregationDimensions sharedDimensions, ITelemetryProducer telemetryProducer)
        {
            var cacheMonitorDimensions = new EventHubCacheMonitorDimensions(sharedDimensions, partition, blockPoolId);
            var cacheMonitor           = this.CacheMonitorFactory(cacheMonitorDimensions, loggerFactory, telemetryProducer);

            return(new EventHubQueueCache(checkpointer, bufferPool, timePurge, loggerFactory.CreateLogger($"{typeof(EventHubQueueCache).FullName}.{sharedDimensions.EventHubPath}.{partition}"), serializationManager,
                                          cacheMonitor, statisticOptions.StatisticMonitorWriteInterval));
        }
 public QueueCacheForTesting(int defaultMaxAddCount, IObjectPool <FixedSizeBuffer> bufferPool, IEventHubDataAdapter dataAdapter, IEvictionStrategy evictionStrategy, IStreamQueueCheckpointer <string> checkpointer, ILogger logger,
                             ICacheMonitor cacheMonitor, TimeSpan?cacheMonitorWriteInterval)
     : base("test", defaultMaxAddCount, bufferPool, dataAdapter, evictionStrategy, checkpointer, logger, cacheMonitor, cacheMonitorWriteInterval, null)
 {
 }
        /// <summary>
        /// Default function to be called to create an EventhubQueueCache in IEventHubQueueCacheFactory.CreateCache method. User can
        /// override this method to add more customization.
        /// </summary>
        protected virtual IEventHubQueueCache CreateCache(string partition, IEventHubDataAdapter dataAdatper, StreamStatisticOptions statisticOptions, IStreamQueueCheckpointer <string> checkpointer,
                                                          ILoggerFactory loggerFactory, IObjectPool <FixedSizeBuffer> bufferPool, string blockPoolId, TimePurgePredicate timePurge,
                                                          SerializationManager serializationManager, EventHubMonitorAggregationDimensions sharedDimensions, ITelemetryProducer telemetryProducer)
        {
            var cacheMonitorDimensions = new EventHubCacheMonitorDimensions(sharedDimensions, partition, blockPoolId);
            var cacheMonitor           = this.CacheMonitorFactory(cacheMonitorDimensions, loggerFactory, telemetryProducer);
            var logger           = loggerFactory.CreateLogger($"{typeof(EventHubQueueCache).FullName}.{sharedDimensions.EventHubPath}.{partition}");
            var evictionStrategy = new ChronologicalEvictionStrategy(logger, timePurge, cacheMonitor, statisticOptions.StatisticMonitorWriteInterval);

            return(new EventHubQueueCache(partition, EventHubAdapterReceiver.MaxMessagesPerRead, bufferPool, dataAdatper, evictionStrategy, checkpointer, logger,
                                          cacheMonitor, statisticOptions.StatisticMonitorWriteInterval));
        }