Exemplo n.º 1
0
        public void ProcessView(EventBean[] newData, EventBean[] oldData, bool isGenerateSynthetic)
        {
            object[] newDataMultiKey = _processor.GenerateGroupKeys(newData, true);
            object[] oldDataMultiKey = _processor.GenerateGroupKeys(oldData, false);

            if (newData != null)
            {
                // apply new data to aggregates
                int count = 0;
                foreach (EventBean aNewData in newData)
                {
                    object mk = newDataMultiKey[count];
                    _processor.EventsPerStreamOneStream[0] = aNewData;
                    _processor.AggregationService.ApplyEnter(_processor.EventsPerStreamOneStream, mk, _processor.AgentInstanceContext);
                    count++;
                }
            }
            if (oldData != null)
            {
                // apply old data to aggregates
                int count = 0;
                foreach (EventBean anOldData in oldData)
                {
                    _processor.EventsPerStreamOneStream[0] = anOldData;
                    _processor.AggregationService.ApplyLeave(_processor.EventsPerStreamOneStream, oldDataMultiKey[count], _processor.AgentInstanceContext);
                    count++;
                }
            }

            if (_processor.Prototype.IsSelectRStream)
            {
                _processor.GenerateOutputBatchedViewPerKey(oldData, oldDataMultiKey, false, isGenerateSynthetic, _outputLastUnordGroupOld, null);
            }
            _processor.GenerateOutputBatchedViewPerKey(newData, newDataMultiKey, false, isGenerateSynthetic, _outputLastUnordGroupNew, null);
        }
Exemplo n.º 2
0
        public void ProcessView(EventBean[] newData, EventBean[] oldData, bool isGenerateSynthetic)
        {
            object[]      newDataMultiKey = _processor.GenerateGroupKeys(newData, true);
            object[]      oldDataMultiKey = _processor.GenerateGroupKeys(oldData, false);
            ISet <object> keysSeenRemoved = new HashSet <object>();

            if (newData != null)
            {
                // apply new data to aggregates
                int count = 0;
                foreach (EventBean aNewData in newData)
                {
                    EventBean[] eventsPerStream = new EventBean[] { aNewData };
                    object      mk = newDataMultiKey[count];
                    _repsPerGroup.Put(mk, eventsPerStream);
                    _lastSeenKeys.Add(mk);
                    _processor.EventsPerStreamOneStream[0] = aNewData;
                    _processor.AggregationService.ApplyEnter(eventsPerStream, mk, _processor.AgentInstanceContext);
                    count++;
                }
            }
            if (oldData != null)
            {
                // apply old data to aggregates
                int count = 0;
                foreach (EventBean anOldData in oldData)
                {
                    object mk = oldDataMultiKey[count];
                    _lastSeenKeys.Add(mk);
                    keysSeenRemoved.Add(mk);
                    _processor.EventsPerStreamOneStream[0] = anOldData;
                    _processor.AggregationService.ApplyLeave(_processor.EventsPerStreamOneStream, oldDataMultiKey[count], _processor.AgentInstanceContext);
                    count++;
                }
            }

            if (_processor.Prototype.IsSelectRStream)
            {
                _processor.GenerateOutputBatchedViewUnkeyed(oldData, oldDataMultiKey, false, isGenerateSynthetic, _eventsOld, null);
            }
            _processor.GenerateOutputBatchedViewUnkeyed(newData, newDataMultiKey, true, isGenerateSynthetic, _eventsNew, null);

            foreach (object keySeen in keysSeenRemoved)
            {
                EventBean newEvent = _processor.GenerateOutputBatchedSingle(keySeen, _repsPerGroup.Get(keySeen), true, isGenerateSynthetic);
                if (newEvent != null)
                {
                    _eventsNew.Add(newEvent);
                }
            }
        }