public RabbitMQRemoteEventSubscriber(RabbitMQSetting rabbitMQSetting)
 {
     _factory             = new PooledObjectFactory(rabbitMQSetting);
     _dictionary          = new ConcurrentDictionary <string, IModel>();
     _connectionsAcquired = new List <IConnection>();
     _rabbitMQSetting     = rabbitMQSetting;
 }
Exemplo n.º 2
0
        public static IRemoteEventBusConfiguration UseRabbitMQ(this IRemoteEventBusConfiguration configuration, Action <RabbitMQSetting> configureAction)
        {
            var setting = new RabbitMQSetting();

            configureAction(setting);
            configuration.UseRabbitMQ(setting);
            return(configuration);
        }
Exemplo n.º 3
0
 public PooledObjectFactory(RabbitMQSetting rabbitMQSetting)
 {
     _connectionFactory = new ConnectionFactory
     {
         Uri = new Uri(rabbitMQSetting.Url),
         AutomaticRecoveryEnabled = true
     };
 }
Exemplo n.º 4
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="poolManager">对象池管理</param>
 /// <param name="rabbitMQSetting">RabbitMQ设置信息</param>
 /// <param name="remoteEventSerializer">序列化对象</param>
 public RabbitMQRemoteEventPublisher(
     IPoolManager poolManager,
     RabbitMQSetting rabbitMQSetting,
     IRemoteEventSerializer remoteEventSerializer
     )
 {
     _remoteEventSerializer = remoteEventSerializer;
     _rabbitMQSetting       = rabbitMQSetting;
     _connectionPool        = poolManager.NewPool <IConnection>()
                              .InitialSize(rabbitMQSetting.InitialSize)
                              .MaxSize(rabbitMQSetting.MaxSize)
                              .WithFactory(new PooledObjectFactory(rabbitMQSetting))
                              .Instance();
 }
Exemplo n.º 5
0
        public static IRemoteEventBusConfiguration UseRabbitMQ(this IRemoteEventBusConfiguration configuration, RabbitMQSetting setting)
        {
            var settingParam = new TypedParameter(typeof(RabbitMQSetting), setting);

            configuration.IocManger.Resolve <IRemoteEventPublisher>(settingParam);
            configuration.IocManger.Resolve <IRemoteEventSubscriber>(settingParam);
            return(configuration);
        }