public static IBusFactory UseTestBroker(this IBrokerConfig brokerConfig) { var services = new ServiceCollection(); services.AddSingleton <IConsumer, TestConsumer>(); services.AddSingleton <IConsumerFactory, TestConsumerFactory>(); services.AddSingleton <ISubscriptionManager, TestSubscriptionManager>(); return(brokerConfig.AddBroker <TestBroker>().AddServices(services)); }
public static IBusFactory UseRabbitMQ(this IBrokerConfig factory, Action <IConfig> action = null) { var config = new Config(); action?.Invoke(config); var services = new ServiceCollection(); services.AddSingleton <IConfig>(config); services.AddSingleton <IChannelFactory, ChannelFactory>(); services.AddSingleton <ISubscriptionManager, SubscriptionManager>(); services.AddTransient <IConsumerFactory, ConsumerFactory>(); return(factory.AddBroker <Broker>().AddServices(services)); }