public RabbitMQRemoteEventSubscriber(IRabbitMqEventBusOptions rabbitMqEventBusOptions)
 {
     _rabbitMqEventBusOptions = rabbitMqEventBusOptions;
     _factory             = new PooledObjectFactory(rabbitMqEventBusOptions);
     _dictionary          = new ConcurrentDictionary <string, IModel>();
     _connectionsAcquired = new List <IConnection>();
 }
Exemple #2
0
 public PooledObjectFactory(IRabbitMqEventBusOptions rabbitMqEventBusOptions)
 {
     Check.NotNullOrWhiteSpace(rabbitMqEventBusOptions.Url, "Url");
     _connectionFactory = new ConnectionFactory
     {
         Uri = new Uri(rabbitMqEventBusOptions.Url),
         AutomaticRecoveryEnabled = true
     };
 }
Exemple #3
0
        public RabbitMQRemoteEventPublisher(
            IPoolManager poolManager,
            IRabbitMqEventBusOptions rabbitMqEventBusOptions
            )
        {
            _rabbitMqEventBusOptions = rabbitMqEventBusOptions;

            _connectionPool = poolManager.NewPool <IConnection>()
                              .WithFactory(new PooledObjectFactory(rabbitMqEventBusOptions))
                              .Instance();
        }
Exemple #4
0
        public IRabbitMQConfiguration Configure(IRabbitMqEventBusOptions eventBusOptions)
        {
            _configuration.IocManager.IocContainer.Register(
                Component.For <IRemoteEventPublisher>()
                .ImplementedBy <RabbitMQRemoteEventPublisher>()
                .DependsOn(Castle.MicroKernel.Registration.Dependency.OnValue <IRabbitMqEventBusOptions>(eventBusOptions))
                .Named(Guid.NewGuid().ToString())
                .LifestyleSingleton()
                .IsDefault()
                );

            _configuration.IocManager.IocContainer.Register(
                Component.For <IRemoteEventSubscriber>()
                .ImplementedBy <RabbitMQRemoteEventSubscriber>()
                .DependsOn(Castle.MicroKernel.Registration.Dependency.OnValue <IRabbitMqEventBusOptions>(eventBusOptions))
                .Named(Guid.NewGuid().ToString())
                .LifestyleSingleton()
                .IsDefault()
                );

            return(this);
        }