Пример #1
0
#pragma warning restore 1591 // Xml Comments

        Dictionary <Type, IProcessEvents> GetSubscriberInstancesFromEvents(IEnumerable <IEvent> events)
        {
            var subscribersBySubscriberTypes = new Dictionary <Type, IProcessEvents>();

            foreach (var @event in events)
            {
                var eventType     = @event.GetType();
                var subscriptions = _allSubscriptions.Where(s => s.EventType.Equals(eventType));
                foreach (var subscription in subscriptions)
                {
                    IProcessEvents instance = null;
                    if (subscribersBySubscriberTypes.ContainsKey(subscription.Owner))
                    {
                        instance = subscribersBySubscriberTypes[subscription.Owner];
                    }
                    else
                    {
                        instance = _container.Get(subscription.Owner) as IProcessEvents;
                        subscribersBySubscriberTypes[subscription.Owner] = instance;
                    }
                }
            }

            return(subscribersBySubscriberTypes);
        }
Пример #2
0
 public ProcessTracker(IProcessEvents parent)
 {
     this.parent = parent;
     this.parent.ProcessStarted += this.OnProcessStarted;
     this.parent.ProcessStopped += this.OnProcessStopped;
     this.processes              = new Dictionary <int, ProcessData>();
 }
Пример #3
0
 public ProcessTracker(IProcessEvents parent)
 {
     this.parent = parent;
     this.parent.ProcessStarted += this.OnProcessStarted;
     this.parent.ProcessStopped += this.OnProcessStopped;
     this.processes = new Dictionary<int, ProcessData>();
 }
Пример #4
0
 void Process(EventSubscription subscription, IProcessEvents subscriber, IEvent @event)
 {
     using (_localizer.BeginScope())
     {
         subscription.Method.Invoke(subscriber, new[] { @event });
         UpdateExistingSubscriptionFrom(subscription, @event.Id);
     }
 }
Пример #5
0
        public void Subscribe(string topicName, IProcessEvents eventProcessor)
        {
            var queueName = $"{eventProcessor.QueuePrefix}.{topicName}";

            var subscription = connection.SubscribeAsync(topicName, queueName);

            subscription.MessageHandler += eventProcessor.HandleSubscription;

            subscription.Start();

            subscriptions.Add(subscription);

            this.log.Information($"Started subscription for {topicName} using queue {queueName}");
        }
Пример #6
0
 public CommandEventProcessingDecorator(IProcessEvents events, Func <IHandleCommand <TCommand> > handlerFactory)
 {
     _events         = events;
     _handlerFactory = handlerFactory;
 }
Пример #7
0
 void Process(EventSubscription subscription, IProcessEvents subscriber, IEvent @event)
 {
     using (_localizer.BeginScope())
     {
         subscription.Method.Invoke(subscriber, new[] { @event });
         UpdateExistingSubscriptionFrom(subscription, @event.Id);
     }
 }
Пример #8
0
 public void Add(string key, IProcessEvents value)
 {
     this.maps.Add(key, value);
 }
Пример #9
0
 public QueryEventProcessingDecorator(IProcessEvents events, Func <IHandleQuery <TQuery, TResult> > handlerFactory)
 {
     _events         = events;
     _handlerFactory = handlerFactory;
 }