コード例 #1
0
        public void Route(Object theEvent)
        {
            if (!(theEvent is Properties))
            {
                throw new EPException("Sender expects a properties event");
            }
            EventBean eventBean = new MyPlugInPropertiesEventBean(_type, (Properties)theEvent);

            _runtimeSender.RouteEventBean(eventBean);
        }
コード例 #2
0
        public void Route(Object theEvent)
        {
            if (!(theEvent.GetType().IsArray))
            {
                throw new EPException("Unexpected event object of type " + theEvent.GetType().Name + ", expected Object[]");
            }
            var       arr = (Object[])theEvent;
            EventBean objectArrayEvent = _eventAdapterService.AdapterForTypedObjectArray(arr, _objectArrayEventType);

            _runtimeEventSender.RouteEventBean(objectArrayEvent);
        }
コード例 #3
0
ファイル: EventSenderAvro.cs プロジェクト: valmac/nesper
        public void Route(Object theEvent)
        {
            if (!(theEvent.GetType().IsArray))
            {
                throw new EPException(
                          "Unexpected event object of type " + theEvent.GetType().FullName + ", expected Object[]");
            }
            EventBean eventBean = _eventAdapterService.AdapterForTypedAvro(theEvent, _eventType);

            _runtimeEventSender.RouteEventBean(eventBean);
        }
コード例 #4
0
ファイル: EventSenderMap.cs プロジェクト: valmac/nesper
        public void Route(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);

            _runtimeEventSender.RouteEventBean(mapEvent);
        }
コード例 #5
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);
                }
            }
        }
コード例 #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;
                }
            }
        }
コード例 #7
0
        public void Route(Object theEvent)
        {
            EventBean eventBean = GetEventBean(theEvent);

            _runtime.RouteEventBean(eventBean);
        }