protected override void ConfigureRabbitMqBus(IRabbitMqBusFactoryConfigurator configurator) { _busHealth = new BusHealth(); configurator.ConnectBusObserver(_busHealth); configurator.ConnectEndpointConfigurationObserver(_busHealth); }
public RegistrationContext(IRegistration registration, BusHealth busHealth, TContainerContext container) { Container = container; _registration = registration; _busHealth = busHealth; }
public BusRegistrationContext(IConfigurationServiceProvider provider, BusHealth busHealth, IRegistrationCache <IEndpointRegistration> endpoints, IRegistrationCache <IConsumerRegistration> consumers, IRegistrationCache <ISagaRegistration> sagas, IRegistrationCache <IExecuteActivityRegistration> executeActivities, IRegistrationCache <IActivityRegistration> activities) : base(provider, consumers, sagas, executeActivities, activities) { _busHealth = busHealth; _endpoints = endpoints; }
protected override void ConfigureActiveMqBus(IActiveMqBusFactoryConfigurator configurator) { _busHealth = new BusHealth(); configurator.UseKillSwitch(options => options .SetActivationThreshold(10) .SetTripThreshold(0.1) .SetRestartTimeout(s: 1)); configurator.ConnectBusObserver(_busHealth); configurator.ConnectEndpointConfigurationObserver(_busHealth); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { _busHealth = new BusHealth(); services.AddMassTransit(x => { x.AddConsumer <MessageConsumer>(); x.AddBus(provider => Bus.Factory.CreateUsingRabbitMq(cfg => { cfg.UseKillSwitch(options => options .SetActivationThreshold(10) .SetTripThreshold(0.1) .SetRestartTimeout(m: 1)); cfg.ConnectBusObserver(_busHealth); cfg.ConnectEndpointConfigurationObserver(_busHealth); cfg.UseHealthCheck(provider); cfg.Host(new Uri("rabbitmq://localhost"), h => { h.Username("guest"); h.Password("guest"); }); cfg.ReceiveEndpoint("testQueue", ep => { ep.PrefetchCount = 1; ep.PurgeOnStartup = false; //ep.UseScheduledRedelivery(r => r.Intervals(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5))); ep.UseMessageRetry(r => r.Interval(2, 100)); ep.ConfigureConsumer <MessageConsumer>(provider); }); })); }); services.AddMassTransitHostedService(); services.AddControllers(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "ApiTwo", Version = "v1" }); }); }
public RiderRegistrationContext(IRegistration registration, BusHealth health, IRegistrationCache <object> registrations) { _registration = registration; _health = health; _registrations = registrations; }