Ejemplo n.º 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);
            }
        }
        public void SendEvent(Object theEvent)
        {
            if (!(theEvent is Properties))
            {
                throw new EPException("Sender expects a properties event");
            }
            EventBean eventBean = new MyPlugInPropertiesEventBean(_type, (Properties)theEvent);

            _runtimeSender.ProcessWrappedEvent(eventBean);
        }
Ejemplo n.º 3
0
 public void Run()
 {
     try
     {
         _runtime.ProcessWrappedEvent(_eventBean);
     }
     catch (Exception e)
     {
         Log.Error("Unexpected error processing wrapped event: " + e.Message, e);
     }
 }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
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);
            }
        }
Ejemplo n.º 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;
                }
            }
        }
Ejemplo n.º 7
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);
                }
            }
        }
Ejemplo n.º 8
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);
            }
        }
Ejemplo n.º 9
0
            public void SendEvent(Object @object)
            {
                EventBean theEvent = _eventAdapterService.AdapterForObject(@object);

                _runtimeEventSender.ProcessWrappedEvent(theEvent);
            }