Пример #1
0
 public MassTransitEndpointListener(IExtendedHost extendedHost, TConsumer consumer,
                                    string queueName, Action <IReceiveEndpointConfigurator> configure = null, bool autoDelete = true)
 {
     _extendedHost = extendedHost;
     _consumer     = consumer;
     _queueName    = queueName;
     _configure    = configure;
     _autoDelete   = autoDelete;
 }
Пример #2
0
        public async Task StopBus()
        {
            if (Host != null)
            {
                await Host.DisconnectAllEndpoints();
            }
            if (Bus != null)
            {
                await Bus.StopAsync();
            }

            Host = null;
            Bus  = null;
        }
Пример #3
0
        public static BusHost CreateUsingRabbitMq(RabbitMqBusSettings rabbitMqSettings,
                                                  Action <IRabbitMqBusFactoryConfigurator> configure = null)
        {
            IExtendedHost host       = null;
            var           busControl = Bus.Factory.CreateUsingRabbitMq(cfg =>
            {
                var rabbitMqHost = cfg.Host(new Uri(rabbitMqSettings.Host), h =>
                {
                    h.Username(rabbitMqSettings.Username);
                    h.Password(rabbitMqSettings.Password);
                });
                host = new RabbitMqExtendedHostProvider(rabbitMqHost);
                cfg.UseNLog(new LogFactory());
                configure?.Invoke(cfg);
            });

            var busHost = new BusHost(busControl, host);

            return(busHost);
        }
Пример #4
0
 public BusHost(IBusControl bus, IExtendedHost host = null)
 {
     Bus  = bus;
     Host = host;
 }