GetPublisherForCommand() публичный Метод

public GetPublisherForCommand ( HystrixCommandKey commandKey, HystrixCommandGroupKey commandOwner, HystrixCommandMetrics metrics, IHystrixCircuitBreaker circuitBreaker, IHystrixCommandProperties properties ) : IHystrixMetricsPublisherCommand
commandKey HystrixCommandKey
commandOwner HystrixCommandGroupKey
metrics HystrixCommandMetrics
circuitBreaker IHystrixCircuitBreaker
properties IHystrixCommandProperties
Результат IHystrixMetricsPublisherCommand
        public void MetricPublisherFactory_SingleInitializePerKey()
        {
            TestHystrixMetricsPublisher publisher = new TestHystrixMetricsPublisher();
            HystrixMetricsPublisherFactory factory = new HystrixMetricsPublisherFactory(publisher);
            List<Thread> threads = new List<Thread>();
            for (int i = 0; i < 20; i++)
            {
                threads.Add(new Thread(() =>
                {
                    factory.GetPublisherForCommand(CommandKeyForUnitTest.KeyOne, null, null, null, null);
                    factory.GetPublisherForCommand(CommandKeyForUnitTest.KeyTwo, null, null, null, null);
                    factory.GetPublisherForThreadPool(ThreadPoolKeyForUnitTest.ThreadPoolOne, null, null);
                }));
            }

            // start them
            foreach (Thread t in threads)
            {
                t.Start();
            }

            // wait for them to finish
            foreach (Thread t in threads)
            {
                t.Join();
            }

            // we should see 2 commands and 1 threadPool publisher created
            Assert.AreEqual(2, publisher.CommandCounter);
            Assert.AreEqual(1, publisher.ThreadCounter);
        }
 public static IHystrixMetricsPublisherCommand CreateOrRetrievePublisherForCommand(HystrixCommandKey commandKey, HystrixCommandGroupKey commandOwner, HystrixCommandMetrics metrics, IHystrixCircuitBreaker circuitBreaker, IHystrixCommandProperties properties)
 {
     return(instance.GetPublisherForCommand(commandKey, commandOwner, metrics, circuitBreaker, properties));
 }