Ejemplo n.º 1
0
        public ManagementApiService(IOptions <MassTransitSettings> settings)
        {
            _settings = settings.Value;

            var provider = new HareDuConfigProvider();

            _config = provider.Configure(c =>
            {
                c.Broker(b =>
                {
                    b.ConnectTo(_settings.ManagementEndpoint);
                    b.UsingCredentials(_settings.UserName, _settings.Password);
                    b.TimeoutAfter(TimeSpan.FromSeconds(5));
                });
                c.Diagnostics(y =>
                {
                    y.Probes(z =>
                    {
                        z.SetMessageRedeliveryThresholdCoefficient(0.60M);
                        z.SetSocketUsageThresholdCoefficient(0.60M);
                        z.SetConsumerUtilizationThreshold(0.65M);
                        z.SetQueueHighFlowThreshold(90);
                        z.SetQueueLowFlowThreshold(10);
                        z.SetRuntimeProcessUsageThresholdCoefficient(0.65M);
                        z.SetFileDescriptorUsageThresholdCoefficient(0.65M);
                        z.SetHighConnectionClosureRateThreshold(90);
                        z.SetHighConnectionCreationRateThreshold(60);
                    });
                });
            });
        }
Ejemplo n.º 2
0
        public async Task Should_be_able_to_get_all_exchanges_3()
        {
            var provider = new HareDuConfigProvider();
            var config   = provider.Configure(x => { });
            var factory  = new BrokerObjectFactory(config);

            var result = await factory
                         .Object <Exchange>()
                         .GetAll()
                         .ScreenDump();

            // result.HasFaulted.ShouldBeFalse();
            Console.WriteLine(result.ToJsonString(Deserializer.Options));
        }
Ejemplo n.º 3
0
        public async Task Test6()
        {
            var provider = new HareDuConfigProvider();

            var config1 = provider.Configure(x =>
            {
                x.Broker(y =>
                {
                    y.ConnectTo("http://localhost:15672");
                    y.UsingCredentials("guest", "guest");
                });

                x.Diagnostics(y =>
                {
                    y.Probes(z =>
                    {
                        z.SetMessageRedeliveryThresholdCoefficient(0.60M);
                        z.SetSocketUsageThresholdCoefficient(0.60M);
                        z.SetConsumerUtilizationThreshold(0.65M);
                        z.SetQueueHighFlowThreshold(90);
                        z.SetQueueLowFlowThreshold(10);
                        z.SetRuntimeProcessUsageThresholdCoefficient(0.65M);
                        z.SetFileDescriptorUsageThresholdCoefficient(0.65M);
                        z.SetHighConnectionClosureRateThreshold(90);
                        z.SetHighConnectionCreationRateThreshold(60);
                    });
                });
            });

            var factory1 = new SnapshotFactory(config1);
            var lens     = factory1.Lens <BrokerConnectivitySnapshot>();

            var result = await lens.TakeSnapshot();

            var      factory2 = new ScannerFactory(config1, new KnowledgeBaseProvider());
            IScanner scanner  = new Scanner(factory2);

            var report = scanner.Scan(result.Snapshot);

            var formatter = new DiagnosticReportTextFormatter();

            string formattedReport = formatter.Format(report);

            Console.WriteLine(formattedReport);
        }