public RabbitMQRemoteEventSubscriber(IRabbitMqEventBusOptions rabbitMqEventBusOptions) { _rabbitMqEventBusOptions = rabbitMqEventBusOptions; _factory = new PooledObjectFactory(rabbitMqEventBusOptions); _dictionary = new ConcurrentDictionary <string, IModel>(); _connectionsAcquired = new List <IConnection>(); }
public PooledObjectFactory(IRabbitMqEventBusOptions rabbitMqEventBusOptions) { Check.NotNullOrWhiteSpace(rabbitMqEventBusOptions.Url, "Url"); _connectionFactory = new ConnectionFactory { Uri = new Uri(rabbitMqEventBusOptions.Url), AutomaticRecoveryEnabled = true }; }
public RabbitMQRemoteEventPublisher( IPoolManager poolManager, IRabbitMqEventBusOptions rabbitMqEventBusOptions ) { _rabbitMqEventBusOptions = rabbitMqEventBusOptions; _connectionPool = poolManager.NewPool <IConnection>() .WithFactory(new PooledObjectFactory(rabbitMqEventBusOptions)) .Instance(); }
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); }