示例#1
0
        public Publisher(PublisherSettings settings, IHandlerSource handlerSource, IDispatcher[] dispatchers)
        {
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            if (handlerSource == null)
            {
                throw new ArgumentNullException("handlerSource");
            }

            if (dispatchers == null)
            {
                throw new ArgumentNullException("dispatchers");
            }

            if (dispatchers.Any(x => ReferenceEquals(x, null)))
            {
                throw new ArgumentException("At least one of dispatches is null.", "dispatchers");
            }

            _settings = settings;
            _handlerSource = handlerSource;
            _dispatchers = dispatchers;
        }
        public virtual void RemoveSource(IHandlerSource handlerSource)
        {
            lock (_latch)
            {
                if (!_sources.Contains(handlerSource))
                {
                    return;
                }

                var newSources = _sources.Except(new[] {handlerSource}).ToArray();

                Interlocked.Exchange(ref _sources, newSources);
            }
        }
        public virtual void AddSource(IHandlerSource handlerSource)
        {
            lock (_latch)
            {
                if (_sources.Contains(handlerSource))
                {
                    return;
                }

                var newSources = new IHandlerSource[_sources.Length + 1];
                _sources.CopyTo(newSources,0);
                newSources[_sources.Length] = handlerSource;

                Interlocked.Exchange(ref _sources, newSources);
            }
        }
示例#4
0
 public void Add(IHandlerSource source)
 {
     _handlers.HandlerSources.Add(source);
 }
示例#5
0
 public void Add(IHandlerSource source)
 {
     _handlers.HandlerSources.Add(source);
 }
示例#6
0
 public IHandlerSetup AddSource(IHandlerSource source)
 {
     Assert.ArgumentNotNull(source, nameof(source));
     _sources.Add(source);
     return(this);
 }
示例#7
0
 public void FindBy(IHandlerSource source)
 {
     _parent.Config.Add(source);
 }
示例#8
0
 public void FindBy(IHandlerSource source)
 {
     _parent._sources.Add(source);
 }
示例#9
0
 public Publisher(IHandlerSource handlerSource, IDispatcher[] dispatchers)
     : this(PublisherSettings.Default, handlerSource, dispatchers)
 {
 }