Example #1
0
        public void SendEvent(Object theEvent)
        {
            if (theEvent == null)
            {
                throw new ArgumentNullException("theEvent", "No event object provided to sendEvent method");
            }

            if ((ExecutionPathDebugLog.IsEnabled) && (Log.IsDebugEnabled))
            {
                if ((!(theEvent is CurrentTimeEvent)) || (ExecutionPathDebugLog.IsTimerDebugEnabled))
                {
                    Log.Debug(".sendEvent Processing event " + theEvent);
                }
            }

            EventBean eventBean = GetEventBean(theEvent);

            // Process event
            if ((ThreadingOption.IsThreadingEnabled) && (_threadingService.IsInboundThreading))
            {
                _threadingService.SubmitInbound(new InboundUnitSendWrapped(eventBean, _runtime).Run);
            }
            else
            {
                _runtime.ProcessWrappedEvent(eventBean);
            }
        }
Example #2
0
        public void SendEvent(Object theEvent)
        {
            EventBean eventBean = _eventAdapterService.AdapterForTypedAvro(theEvent, _eventType);

            if ((ThreadingOption.IsThreadingEnabled) && (_threadingService.IsInboundThreading))
            {
                _threadingService.SubmitInbound(new InboundUnitSendWrapped(eventBean, _runtimeEventSender).Run);
            }
            else
            {
                _runtimeEventSender.ProcessWrappedEvent(eventBean);
            }
        }
Example #3
0
        private void SendEvent(Object node, bool isRoute)
        {
            XmlNode namedNode;

            if (node is XmlDocument)
            {
                namedNode = ((XmlDocument)node).DocumentElement;
            }
            else if (node is XmlElement)
            {
                namedNode = (XmlElement)node;
            }
            else
            {
                throw new EPException("Unexpected event object type '" + node.GetType().FullName + "' encountered, please supply a System.Xml.XmlDocument or Element node");
            }

            if (_validateRootElement)
            {
                var theNodeName = namedNode.LocalName;
                if (theNodeName == null)
                {
                    theNodeName = namedNode.Name;
                }

                if (!theNodeName.Equals(_baseXmlEventType.RootElementName))
                {
                    throw new EPException("Unexpected root element name '" + theNodeName + "' encountered, expected a root element name of '" + _baseXmlEventType.RootElementName + "'");
                }
            }

            EventBean theEvent = _eventAdapterService.AdapterForTypedDOM(namedNode, _baseXmlEventType);

            if (isRoute)
            {
                _runtimeEventSender.RouteEventBean(theEvent);
            }
            else
            {
                if ((ThreadingOption.IsThreadingEnabledValue) && (_threadingService.IsInboundThreading))
                {
                    _threadingService.SubmitInbound(new InboundUnitSendWrapped(theEvent, _runtimeEventSender).Run);
                }
                else
                {
                    _runtimeEventSender.ProcessWrappedEvent(theEvent);
                }
            }
        }
Example #4
0
        public void SendEvent(Object theEvent)
        {
            if (!(theEvent.GetType().IsArray))
            {
                throw new EPException("Unexpected event object of type " + theEvent.GetType().FullName + ", expected Object[]");
            }

            var       arr = (Object[])theEvent;
            EventBean objectArrayEvent = _eventAdapterService.AdapterForTypedObjectArray(arr, _objectArrayEventType);

            if ((ThreadingOption.IsThreadingEnabledValue) && (_threadingService.IsInboundThreading))
            {
                _threadingService.SubmitInbound(new InboundUnitSendWrapped(objectArrayEvent, _runtimeEventSender).Run);
            }
            else
            {
                _runtimeEventSender.ProcessWrappedEvent(objectArrayEvent);
            }
        }
Example #5
0
        public void SendEvent(Object theEvent)
        {
            if (!(theEvent is DataMap))
            {
                throw new EPException("Unexpected event object of type " + theEvent.GetType().FullName + ", expected " +
                                      typeof(DataMap).FullName);
            }

            var       map      = (DataMap)theEvent;
            EventBean mapEvent = _eventAdapterService.AdapterForTypedMap(map, _mapEventType);

            if ((ThreadingOption.IsThreadingEnabledValue) && (_threadingService.IsInboundThreading))
            {
                _threadingService.SubmitInbound(() => _runtimeEventSender.ProcessWrappedEvent(mapEvent));
            }
            else
            {
                _runtimeEventSender.ProcessWrappedEvent(mapEvent);
            }
        }
Example #6
0
        private void SendIn(Object theEvent, bool isRoute)
        {
            // Ask each factory in turn to take care of it
            foreach (EventSenderURIDesc entry in _handlingFactories)
            {
                EventBean eventBean = null;

                try
                {
                    eventBean = entry.BeanFactory(theEvent, entry.ResolutionURI);
                }
                catch (Exception ex)
                {
                    Log.Warn("Unexpected exception thrown by plug-in event bean factory '" + entry.BeanFactory + "' processing event " + theEvent, ex);
                }

                if (eventBean != null)
                {
                    if (isRoute)
                    {
                        _epRuntime.RouteEventBean(eventBean);
                    }
                    else
                    {
                        if ((ThreadingOption.IsThreadingEnabledValue) && (_threadingService.IsInboundThreading))
                        {
                            _threadingService.SubmitInbound(() => _epRuntime.ProcessWrappedEvent(eventBean));
                        }
                        else
                        {
                            _epRuntime.ProcessWrappedEvent(eventBean);
                        }
                    }
                    return;
                }
            }
        }