private void ReloadConfig(object sender, EventArgs e)
        {
            List <IActivityDispatcher> dispatchers = new List <IActivityDispatcher>(this.activityDispatchers);
            ActivityEngineConfig       config      = BaseConfig <ActivityEngineConfig> .Instance;
            List <IActivityDispatcher> removeList  = new List <IActivityDispatcher>();

            foreach (IActivityDispatcher dispatcher4 in dispatchers)
            {
                if (!(dispatcher4 is EsbInterfaceActivityDispatcher) && !(dispatcher4 is RestfulActivityDispatcher))
                {
                    if (!config.ActivitySubscribers.Contains(dispatcher4.Name))
                    {
                        removeList.Add(dispatcher4);
                    }
                    else
                    {
                        ActivitySubscriberConfig subscriberConfig = config.GetActivitySubscriberConfig(dispatcher4.Name);
                        if (subscriberConfig.SubscriberType != ActivitySubscriberType.LocalDispatcher || !dispatcher4.GetType().AssemblyQualifiedName.StartsWith(subscriberConfig.DispatcherImpl ?? string.Empty))
                        {
                            removeList.Add(dispatcher4);
                        }
                    }
                }
            }
            foreach (IActivityDispatcher dispatcher2 in removeList)
            {
                dispatchers.Remove(dispatcher2);
            }
            foreach (IActivityDispatcher dispatcher in dispatchers)
            {
                Util.ExecuteWithCatch(delegate
                {
                    dispatcher.ReloadConfig();
                }
                                      );
            }
            Dictionary <string, string> map = new Dictionary <string, string>(dispatchers.Count);

            foreach (IActivityDispatcher dispatcher3 in dispatchers)
            {
                map.Add(dispatcher3.Name, string.Empty);
            }
            foreach (ActivitySubscriberConfig subscriber in config.ActivitySubscribers)
            {
                if (subscriber.SubscriberType == ActivitySubscriberType.LocalDispatcher && !map.ContainsKey(subscriber.Name))
                {
                    Util.ExecuteWithCatch(delegate
                    {
                        dispatchers.Add(this.BuildDispatcher(subscriber));
                    }
                                          );
                }
            }
            this.activityDispatchers = dispatchers;
        }
        private void BuildActivityDispatchers()
        {
            List <IActivityDispatcher> dispatchers = new List <IActivityDispatcher>();
            ActivityEngineConfig       config      = BaseConfig <ActivityEngineConfig> .Instance;

            if (config.ActivitySubscribers != null)
            {
                foreach (ActivitySubscriberConfig subscriber in config.ActivitySubscribers)
                {
                    if (subscriber.SubscriberType == ActivitySubscriberType.LocalDispatcher)
                    {
                        Util.ExecuteWithCatch(delegate
                        {
                            dispatchers.Add(this.BuildDispatcher(subscriber));
                        }
                                              );
                    }
                }
            }
            dispatchers.Add(new EsbInterfaceActivityDispatcher());
            dispatchers.Add(new RestfulActivityDispatcher());
            this.activityDispatchers = dispatchers;
        }