private string GetFallbackEnvelopeFormat(string format) { using var ere = new EventRecordEnvelope(_data, _includeEventData, BookmarkData as IntegerPositionRecordBookmark); var message = ere.GetMessage(format); return(message); }
private void SendEventRecord(EventRecord eventRecord) { if (InitialPosition == InitialPositionEnum.Timestamp && eventRecord.TimeCreated.HasValue && InitialPositionTimestamp > eventRecord.TimeCreated.Value.ToUniversalTime()) { return; //Don't send if timetamp initial position is in the future } EventRecordEnvelope envelope; if (_options.CustomFilters.Length > 0) { // Create new envelope with event data for filtering envelope = new EventRecordEnvelope(eventRecord, true, _options.BookmarkOnBufferFlush ? new IntegerPositionRecordBookmark(Id, Id, eventRecord.RecordId ?? 0) : null); //Don't send if any filter return false if (_options.CustomFilters.Any(name => !EventInfoFilters.GetFilter(name)(eventRecord))) { return; } //Strip off Event Data if not configured if (!_options.IncludeEventData) { envelope.Data.EventData = null; } } else { envelope = new EventRecordEnvelope(eventRecord, _options.IncludeEventData, _options.BookmarkOnBufferFlush ? new IntegerPositionRecordBookmark(Id, Id, eventRecord.RecordId ?? 0) : null); } _recordSubject.OnNext(envelope); _metrics?.PublishCounter(Id, MetricsConstants.CATEGORY_SOURCE, CounterTypeEnum.Increment, MetricsConstants.EVENTLOG_SOURCE_EVENTS_READ, 1, MetricUnit.Count); }
private void SendEventRecord(EventRecord eventRecord) { if (this.InitialPosition == InitialPositionEnum.Timestamp && this.InitialPositionTimestamp.HasValue && eventRecord.TimeCreated.HasValue && this.InitialPositionTimestamp.Value > eventRecord.TimeCreated.Value.ToUniversalTime()) { return; //Don't send if timetamp initial position is in the future } EventRecordEnvelope envelope; if (this.customFilters.Length > 0) { envelope = new EventRecordEnvelope(eventRecord, true, this.bookmarkId); //Need event data for filtering //Don't send if any filter return false if (this.customFilters.Any(name => !EventInfoFilters.GetFilter(name)(envelope.Data))) { return; } //Strip off Event Data if not configured if (!this.includeEventData) { envelope.Data.EventData = null; } } else { envelope = new EventRecordEnvelope(eventRecord, this.includeEventData, this.bookmarkId); } this.recordSubject.OnNext(envelope); this._metrics?.PublishCounter(this.Id, MetricsConstants.CATEGORY_SOURCE, CounterTypeEnum.Increment, MetricsConstants.EVENTLOG_SOURCE_EVENTS_READ, 1, MetricUnit.Count); }