public void Init(ProcessorContext context, IStateStore root) { this.context = context; expiredRecordSensor = TaskMetrics.DroppedRecordsSensor( Thread.CurrentThread.Name, context.Id, context.Metrics); segments.OpenExisting(context, observedStreamTime); context.Register(root, (k, v, t) => Put(k, v)); isOpen = true; }
public virtual void Init(ProcessorContext context) { log.LogDebug("{LogPrefix}Initializing process context", logPrefix); Context = context; droppedRecordsSensor = TaskMetrics.DroppedRecordsSensor( Thread.CurrentThread.Name, Context.Id, Context.Metrics); foreach (var n in Next) { n.Init(context); } log.LogDebug("{LogPrefix}Process context initialized", logPrefix); }
public void Init(ProcessorContext context, IStateStore root) { expiredRecordSensor = TaskMetrics.DroppedRecordsSensor( Thread.CurrentThread.Name, context.Id, context.Metrics); this.context = context; if (root != null) { // register the store context.Register(root, (key, value, timestamp) => Put(key, value, timestamp)); } IsOpen = true; }
public StreamTask(string threadId, TaskId id, IEnumerable <TopicPartition> partitions, ProcessorTopology processorTopology, IConsumer <byte[], byte[]> consumer, IStreamConfig configuration, IKafkaSupplier kafkaSupplier, IProducer <byte[], byte[]> producer, IChangelogRegister changelogRegister, StreamMetricsRegistry streamMetricsRegistry) : base(id, partitions, processorTopology, consumer, configuration, changelogRegister) { this.threadId = threadId; this.kafkaSupplier = kafkaSupplier; this.streamMetricsRegistry = streamMetricsRegistry; consumedOffsets = new Dictionary <TopicPartition, long>(); maxTaskIdleMs = configuration.MaxTaskIdleMs; maxBufferedSize = configuration.BufferedRecordsPerPartition; followMetadata = configuration.FollowMetadata; idleStartTime = -1; // eos enabled if (producer == null) { this.producer = CreateEOSProducer(); InitializeTransaction(); eosEnabled = true; } else { this.producer = producer; } var droppedRecordsSensor = TaskMetrics.DroppedRecordsSensor(this.threadId, Id, this.streamMetricsRegistry); collector = new RecordCollector(logPrefix, configuration, id, droppedRecordsSensor); collector.Init(ref this.producer); Context = new ProcessorContext(this, configuration, stateMgr, streamMetricsRegistry) .UseRecordCollector(collector); Context.FollowMetadata = followMetadata; var partitionsQueue = new Dictionary <TopicPartition, RecordQueue>(); foreach (var p in partitions) { var sourceProcessor = processorTopology.GetSourceProcessor(p.Topic); sourceProcessor.SetTaskId(id); var sourceTimestampExtractor = sourceProcessor.Extractor ?? configuration.DefaultTimestampExtractor; var queue = new RecordQueue( logPrefix, $"record-queue-{p.Topic}-{id.Id}-{id.Partition}", sourceTimestampExtractor, p, sourceProcessor, droppedRecordsSensor); partitionsQueue.Add(p, queue); processors.Add(sourceProcessor); } partitionGrouper = new PartitionGrouper(partitionsQueue); closeTaskSensor = ThreadMetrics.ClosedTaskSensor(this.threadId, streamMetricsRegistry); activeBufferedRecordSensor = TaskMetrics.ActiveBufferedRecordsSensor(this.threadId, Id, streamMetricsRegistry); processSensor = TaskMetrics.ProcessSensor(this.threadId, Id, streamMetricsRegistry); processLatencySensor = TaskMetrics.ProcessLatencySensor(this.threadId, Id, streamMetricsRegistry); enforcedProcessingSensor = TaskMetrics.EnforcedProcessingSensor(this.threadId, Id, streamMetricsRegistry); commitSensor = TaskMetrics.CommitSensor(this.threadId, Id, streamMetricsRegistry); activeRestorationSensor = TaskMetrics.ActiveRestorationSensor(this.threadId, Id, streamMetricsRegistry); restorationRecordsSendsor = TaskMetrics.RestorationRecordsSensor(this.threadId, Id, streamMetricsRegistry); }