public static IBusControl Create(MassTransitOptions options, Action <IRabbitMqBusFactoryConfigurator, IRabbitMqHost> registrationAction = null) { return(Bus.Factory.CreateUsingRabbitMq(cfg => { var host = cfg.Host(options.HostUri, hst => { hst.Username(options.Username); hst.Password(options.Password); }); if (options.RetryPolicy != null) { cfg.UseRetry(options.RetryPolicy); } if (options.TripThreshold != null && options.ActiveThreshold != null && options.ResetInterval != null) { cfg.UseCircuitBreaker(cb => { cb.TripThreshold = options.TripThreshold.Value; cb.ActiveThreshold = options.ActiveThreshold.Value; cb.ResetInterval = TimeSpan.FromMinutes(options.ResetInterval.Value); }); } if (options.RateLimit != null && options.RateLimiterInterval != null) { cfg.UseRateLimit(options.RateLimit.Value, TimeSpan.FromSeconds(options.RateLimiterInterval.Value)); } registrationAction?.Invoke(cfg, host); })); }
public MassTransitEventBus(MassTransitOptions options) { _options = options; }