コード例 #1
0
 /// <summary>
 /// 
 /// </summary>
 /// 
 /// <param name="canonicalEvent"></param>
 /// 
 public CanonicalEventArgs(CanonicalEvent canonicalEvent)
 {
     if (canonicalEvent == null)
     {
         throw new ArgumentNullException("canonicalEvent");
     }
     this.canonicalEvent = canonicalEvent;
 }
コード例 #2
0
        /// <summary>
        /// 
        /// </summary>
        /// 
        public override void Listen()
        {
            CanonicalEvent @event = new CanonicalEvent();
            @event.EventType = "StandardEvent";
            @event.Payload = "<message description=\"standard event\" />";

            FireOnEventSourceReceievedEvent(@event);
            Deliver(@event);
        }
コード例 #3
0
        /// <summary>
        /// 
        /// </summary>
        /// 
        /// <param name="@event"></param>
        /// 
        public void Send(CanonicalEvent @event)
        {
            EventItem<CanonicalEvent> item = new EventItem<CanonicalEvent>(@event);
            lock (queue)
            {
                if (Logger.IsDebugEnabled)
                {
                    LogDebug("channel size: {0}.", queue.Count);
                }

                queue.Enqueue(item);
                Monitor.Pulse(queue);

                // disable the following line to make this a blocking channel.
                // Monitor.Wait(queue);
            }
        }
コード例 #4
0
        /// <summary>
        /// 
        /// </summary>
        /// 
        /// <param name="@event"></param>
        /// 
        public override void Process(CanonicalEvent @event)
        {
            if (@event == null)
            {
                LogWarn("received null event!");
                return;
            }

            List<IEventRule> rules = EventRuleRegistry.GetRules(@event.EventType);
            if (rules == null)
            {
                return;
            }

            foreach (EventRule rule in rules)
            {
                rule.Invoke(@event);
            }
        }
コード例 #5
0
 /// <summary>
 /// 
 /// </summary>
 /// 
 /// <param name="@event"></param>
 /// 
 protected void FireOnEventNotificationReceievedEvent(CanonicalEvent @event)
 {
     if (OnEventNotificationReceived != null)
     {
         OnEventNotificationReceived.Invoke(this, new CanonicalEventArgs(@event));
     }
 }
コード例 #6
0
 /// <summary>
 /// 
 /// </summary>
 /// 
 /// <param name="@event"></param>
 /// 
 public abstract void Notify(CanonicalEvent @event);
コード例 #7
0
 /// <summary>
 /// 
 /// </summary>
 /// 
 /// <param name="@event"></param>
 /// 
 public override void Notify(CanonicalEvent @event)
 {
     Console.WriteLine("firing event notification...");
 }
コード例 #8
0
ファイル: EventAction.cs プロジェクト: abelperez/mindplex-eda
 /// <summary>
 /// 
 /// </summary>
 /// 
 /// <param name="@event"></param>
 /// 
 public abstract void Execute(CanonicalEvent @event);
コード例 #9
0
ファイル: EventAction.cs プロジェクト: abelperez/mindplex-eda
 /// <summary>
 /// 
 /// </summary>
 /// 
 /// <param name="@event"></param>
 /// <param name="destination"></param>
 /// 
 protected void Deliver(CanonicalEvent @event)
 {
     if (outputStream != null)
     {
         if (Logger.IsDebugEnabled)
         {
             LogDebug("delivering event type: {0} to destination: {1}.", @event.EventType, destination);
         }
         outputStream.Send(@event);
     }
 }
コード例 #10
0
 /// <summary>
 /// 
 /// </summary>
 /// 
 /// <param name="@event"></param>
 /// 
 protected void FireOnEventProcessEndEvent(CanonicalEvent @event)
 {
     if (OnEventProcessEnd != null)
     {
         OnEventProcessEnd.Invoke(this, new CanonicalEventArgs(@event));
     }
 }
コード例 #11
0
 /// <summary>
 /// 
 /// </summary>
 /// 
 /// <param name="@event"></param>
 /// 
 public abstract void Process(CanonicalEvent @event);
コード例 #12
0
ファイル: EventSource.cs プロジェクト: abelperez/mindplex-eda
 /// <summary>
 /// 
 /// </summary>
 /// 
 /// <param name="@event"></param>
 /// 
 protected void FireOnEventSourceDeliveredEvent(CanonicalEvent @event)
 {
     if (OnEventSourceDelivered != null)
     {
         OnEventSourceDelivered.Invoke(this, new CanonicalEventArgs(@event));
     }
 }
コード例 #13
0
ファイル: EventSource.cs プロジェクト: abelperez/mindplex-eda
        /// <summary>
        /// 
        /// </summary>
        /// 
        /// <param name="@event"></param>
        /// 
        protected virtual void Deliver(CanonicalEvent @event)
        {
            try
            {
                if (!initialized)
                {
                    if (Logger.IsErrorEnabled)
                    {
                        LogError("source has not initialized for destination: {0}.", destination);
                    }
                    throw new EventSourceException("source has not initialized for destination: {0}.", destination);
                }

                outputStream.Send(@event);
                FireOnEventSourceDeliveredEvent(@event);
            }
            catch(Exception exception)
            {
                if (Logger.IsErrorEnabled)
                {
                    LogError("failed to deliver event.", exception);
                }
                FireOnInternalEventSourceExceptionEvent(exception);
            }
        }