示例#1
0
 public EventBus(ILifetimeScope scope,
                 IOptions <BrokerOptions> options)
 {
     Scope         = scope;
     BrokerOptions = options;
     Factory       = BrokerMessageConnectionFactory.CreateConnection(BrokerOptions.Value);
     Connection    = Factory.CreateConnection();
     Channel       = Connection.CreateModel();
 }
示例#2
0
 public EventBus(IComponentContext context,
                 IOptions <BrokerOptions> options,
                 Action <ContainerBuilder, IConfiguration> configureScope)
 {
     Context        = context;
     BrokerOptions  = options;
     Factory        = BrokerMessageConnectionFactory.CreateConnection(BrokerOptions.Value);
     Connection     = Factory.CreateConnection();
     Channel        = Connection.CreateModel();
     ConfigureScope = configureScope;
 }
        protected virtual void Init()
        {
            Factory = BrokerMessageConnectionFactory.CreateConnection(BrokerOptions);

            if (!string.IsNullOrEmpty(BrokerOptions.UserName))
            {
                Factory.UserName = BrokerOptions.UserName;
            }

            if (!string.IsNullOrEmpty(BrokerOptions.Password))
            {
                Factory.Password = BrokerOptions.Password;
            }

            Connection = Factory.CreateConnection();
            Channel    = Connection.CreateModel();
        }