Пример #1
0
        public void ProcessView(
            EventBean[] newData,
            EventBean[] oldData,
            bool isGenerateSynthetic)
        {
            if (newData != null) {
                foreach (var aNewData in newData) {
                    EventBean[] eventsPerStream = {aNewData};
                    var mk = processor.GenerateGroupKeySingle(eventsPerStream, true);

                    // if this is a newly encountered group, generate the remove stream event
                    if (groupReps.Push(mk, eventsPerStream) == null) {
                        if (processor.IsSelectRStream) {
                            var @event = processor.GenerateOutputBatchedNoSortWMap(
                                false,
                                mk,
                                eventsPerStream,
                                true,
                                isGenerateSynthetic);
                            if (@event != null) {
                                groupRepsOutputLastUnordRStream.Put(mk, @event);
                            }
                        }
                    }

                    processor.AggregationService.ApplyEnter(eventsPerStream, mk, processor.GetAgentInstanceContext());
                }
            }

            if (oldData != null) {
                foreach (var anOldData in oldData) {
                    EventBean[] eventsPerStream = {anOldData};
                    var mk = processor.GenerateGroupKeySingle(eventsPerStream, true);

                    if (groupReps.Push(mk, eventsPerStream) == null) {
                        if (processor.IsSelectRStream) {
                            var @event = processor.GenerateOutputBatchedNoSortWMap(
                                false,
                                mk,
                                eventsPerStream,
                                false,
                                isGenerateSynthetic);
                            if (@event != null) {
                                groupRepsOutputLastUnordRStream.Put(mk, @event);
                            }
                        }
                    }

                    processor.AggregationService.ApplyLeave(eventsPerStream, mk, processor.GetAgentInstanceContext());
                }
            }
        }
        public void ProcessView(
            EventBean[] newData,
            EventBean[] oldData,
            bool isGenerateSynthetic)
        {
            GenerateRemoveStreamJustOnce(isGenerateSynthetic, false);

            if (newData != null) {
                foreach (var aNewData in newData) {
                    EventBean[] eventsPerStream = {aNewData};
                    var mk = processor.GenerateGroupKeySingle(eventsPerStream, true);
                    groupReps.Put(mk, eventsPerStream);

                    if (processor.IsSelectRStream && !groupRepsOutputLastUnordRStream.ContainsKey(mk)) {
                        var @event = processor.GenerateOutputBatchedNoSortWMap(
                            false,
                            mk,
                            eventsPerStream,
                            true,
                            isGenerateSynthetic);
                        if (@event != null) {
                            groupRepsOutputLastUnordRStream.Put(mk, @event);
                        }
                    }

                    processor.AggregationService.ApplyEnter(eventsPerStream, mk, processor.GetAgentInstanceContext());
                }
            }

            if (oldData != null) {
                foreach (var anOldData in oldData) {
                    EventBean[] eventsPerStream = {anOldData};
                    var mk = processor.GenerateGroupKeySingle(eventsPerStream, true);

                    if (processor.IsSelectRStream && !groupRepsOutputLastUnordRStream.ContainsKey(mk)) {
                        var @event = processor.GenerateOutputBatchedNoSortWMap(
                            false,
                            mk,
                            eventsPerStream,
                            false,
                            isGenerateSynthetic);
                        if (@event != null) {
                            groupRepsOutputLastUnordRStream.Put(mk, @event);
                        }
                    }

                    processor.AggregationService.ApplyLeave(eventsPerStream, mk, processor.GetAgentInstanceContext());
                }
            }
        }