public IRabbitMqHostConfiguration CreateHostConfiguration(IRabbitMqHostControl host)
        {
            var hostConfiguration = new RabbitMqHostConfiguration(this, host);

            _hosts.Add(hostConfiguration);

            return(hostConfiguration);
        }
Exemple #2
0
        public RabbitMqQueueReceiveEndpointContext(IRabbitMqHostControl host, IRabbitMqReceiveEndpointConfiguration configuration, BrokerTopology brokerTopology)
            : base(configuration)
        {
            _host = host;

            ExclusiveConsumer = configuration.Settings.ExclusiveConsumer;
            BrokerTopology    = brokerTopology;
        }
        public RabbitMqHostConfiguration(IRabbitMqBusConfiguration busConfiguration, RabbitMqHostSettings hostSettings, IRabbitMqHostTopology hostTopology)
        {
            _busConfiguration = busConfiguration;
            _hostSettings     = hostSettings;
            _hostTopology     = hostTopology;

            _host = new RabbitMqHost(this);

            Description = FormatDescription(hostSettings);
        }
Exemple #4
0
        public PublishTransportProvider(IRabbitMqHostControl host, IModelContextSupervisor modelContextSupervisor)
        {
            _host = host;
            _modelContextSupervisor = modelContextSupervisor;

            var cacheSettings = new CacheSettings(SendEndpointCacheDefaults.Capacity, SendEndpointCacheDefaults.MinAge, SendEndpointCacheDefaults.MaxAge);

            var cache = new GreenCache <CachedSendTransport>(cacheSettings);

            _index = cache.AddIndex("key", x => x.Address);
        }
        public void Build(IRabbitMqHostControl host)
        {
            var builder = new RabbitMqReceiveEndpointBuilder(host, this);

            ApplySpecifications(builder);

            var receiveEndpointContext = builder.CreateReceiveEndpointContext();

            _modelConfigurator.UseFilter(new ConfigureTopologyFilter <ReceiveSettings>(_settings, receiveEndpointContext.BrokerTopology));

            IAgent consumerAgent;

            if (_hostConfiguration.DeployTopologyOnly)
            {
                var transportReadyFilter = new TransportReadyFilter <ModelContext>(receiveEndpointContext);
                _modelConfigurator.UseFilter(transportReadyFilter);

                consumerAgent = transportReadyFilter;
            }
            else
            {
                if (_settings.PurgeOnStartup)
                {
                    _modelConfigurator.UseFilter(new PurgeOnStartupFilter(_settings.QueueName));
                }

                _modelConfigurator.UseFilter(new PrefetchCountFilter(_managementPipe, _settings.PrefetchCount));

                var consumerFilter = new RabbitMqConsumerFilter(receiveEndpointContext);

                _modelConfigurator.UseFilter(consumerFilter);

                consumerAgent = consumerFilter;
            }

            IFilter <ConnectionContext> modelFilter = new ReceiveEndpointFilter(_modelConfigurator.Build());

            _connectionConfigurator.UseFilter(modelFilter);

            var transport = new RabbitMqReceiveTransport(host, _settings, _connectionConfigurator.Build(), receiveEndpointContext);

            transport.Add(consumerAgent);

            var receiveEndpoint = new ReceiveEndpoint(transport, receiveEndpointContext);

            var queueName = _settings.QueueName ?? NewId.Next().ToString(FormatUtil.Formatter);

            host.AddReceiveEndpoint(queueName, receiveEndpoint);

            ReceiveEndpoint = receiveEndpoint;
        }
Exemple #6
0
 protected override IAgent <ModelContext> GetModelSource(IRabbitMqHostControl rabbitMqHostControl)
 {
     return(new ReceiveModelSource(_modelContext, _receiveContext));
 }
 public RabbitMqPublishTransportProvider(IRabbitMqHostControl host, IModelContextSupervisor modelContextSupervisor)
 {
     _host = host;
     _modelContextSupervisor = modelContextSupervisor;
 }
Exemple #8
0
 public SendTransportProvider(IRabbitMqHostControl host)
 {
     _host = host;
 }
Exemple #9
0
 public RabbitMqReceiveEndpointBuilder(IRabbitMqHostControl host, IRabbitMqReceiveEndpointConfiguration configuration)
     : base(configuration)
 {
     _host          = host;
     _configuration = configuration;
 }
 public RabbitMqHostConfiguration(IRabbitMqBusConfiguration busConfiguration, IRabbitMqHostControl host)
 {
     _host             = host;
     _busConfiguration = busConfiguration;
 }
Exemple #11
0
 public PublishTransportProvider(IRabbitMqHostControl host, IRabbitMqPublishTopology publishTopology)
 {
     _publishTopology = publishTopology;
     _host            = host;
 }
 protected virtual IAgent <ModelContext> GetModelSource(IRabbitMqHostControl host)
 {
     return(new RabbitMqModelCache(host, host.ConnectionCache));
 }