예제 #1
0
        /// <summary>
        /// Adds a <see cref="ISubscriberFactory{TSubscriber}"/> to the set of factories for runtime creation of <see cref="ISubscriber"/>s
        /// </summary>
        /// <param name="factory">Factory that will be used to create <see cref="ISubscriber"/>s when 
        /// <see cref="AddSubscriber{TSubscriber}(IAddress)"/> is called</param>
        public void AddFactory(ISubscriberFactory factory)
        {
            if (factory is null)
                throw new ArgumentNullException(nameof(factory));

            if (factories.ContainsKey(factory.SubscriberType))
                return;

            factories.Add(factory.SubscriberType, factory);
            monitorCache.AddMonitor(factory.SubscriberMonitor);
        }
예제 #2
0
        /// <summary>
        /// Adds a <see cref="IReceiverFactory{TReceiver}"/> to the set of factories configuration time creation of <see cref="IReceiver"/>s
        /// </summary>
        /// <param name="factory">Factory that will be used to create <see cref="IReceiver"/>s when
        /// <see cref="AddReceiver{TReceiver}(IAddress)"/> is called</param>
        public void AddFactory(IReceiverFactory factory)
        {
            if (factory is null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            if (factories.ContainsKey(factory.ReceiverType))
            {
                return;
            }

            factories.Add(factory.ReceiverType, factory);
            monitorCache.AddMonitor(factory.ReceiverMonitor);
        }