Ejemplo n.º 1
0
        public EventBus(ILifetimeScope autofac)
        {
            _autofac = autofac;

            if (!autofac.IsRegistered <EventBusSettings>())
            {
                throw new ArgumentNullException("Registre as configurações do EventBus");
            }
            else
            {
                settings = autofac.Resolve <EventBusSettings>();
            }

            var factory = new ConnectionFactory()
            {
                HostName    = settings.HostName,
                VirtualHost = settings.VirtualHost,
                UserName    = settings.UserName,
                Password    = settings.Password,
                Port        = settings.Port
            };

            _connection = factory.CreateConnection();

            _subscriptionManager = new SubscriptionsManager();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Registra as configurações do EventBus
        /// </summary>
        /// <param name="action"></param>
        /// <returns></returns>
        public EventBusService Configure(Action <EventBusSettings> action)
        {
            var settings = new EventBusSettings();

            action(settings);
            _builder.RegisterInstance(settings);
            return(this);
        }