示例#1
0
        public HostReceiveEndpointHandle ConnectSubscriptionEndpoint(string subscriptionName, string topicName,
                                                                     Action <IServiceBusSubscriptionEndpointConfigurator> configure = null)
        {
            var settings = new SubscriptionEndpointSettings(topicName, subscriptionName);

            return(ConnectSubscriptionEndpoint(settings, configure));
        }
示例#2
0
        IBrokeredMessageReceiver CreateBrokeredMessageReceiver(string topicPath, string subscriptionName, Action <IReceiveEndpointConfigurator> configure)
        {
            if (string.IsNullOrWhiteSpace(topicPath))
            {
                throw new ArgumentNullException(nameof(topicPath));
            }
            if (configure == null)
            {
                throw new ArgumentNullException(nameof(configure));
            }

            var subscriptionPath = EntityNameHelper.FormatSubscriptionPath(topicPath, subscriptionName);

            return(_receivers.GetOrAdd(subscriptionPath, name =>
            {
                var topicConfigurator = new TopicConfigurator(topicPath, false);
                var settings = new SubscriptionEndpointSettings(topicConfigurator.GetTopicDescription(), subscriptionName);

                var endpointConfiguration = _hostConfiguration.CreateSubscriptionEndpointConfiguration(settings);

                var configurator = new SubscriptionBrokeredMessageReceiverConfiguration(_hostConfiguration, endpointConfiguration);

                configure(configurator);

                return configurator.Build();
            }));
        }
示例#3
0
        public HostReceiveEndpointHandle ConnectSubscriptionEndpoint <T>(string subscriptionName,
                                                                         Action <IServiceBusSubscriptionEndpointConfigurator> configure = null)
            where T : class
        {
            var settings = new SubscriptionEndpointSettings(Topology.Publish <T>().TopicDescription, subscriptionName);

            return(ConnectSubscriptionEndpoint(settings, configure));
        }
 public ServiceBusSubscriptionEndpointSpecification(IServiceBusHost host, SubscriptionEndpointSettings settings,
                                                    IServiceBusEndpointConfiguration configuration, ISendTransportProvider sendTransportProvider)
     : base(host, settings, settings.SubscriptionConfigurator, configuration)
 {
     _settings              = settings;
     _configuration         = configuration;
     _sendTransportProvider = sendTransportProvider;
 }
        public ServiceBusSubscriptionEndpointConfiguration(IServiceBusHostConfiguration hostConfiguration,
                                                           SubscriptionEndpointSettings settings, IServiceBusEndpointConfiguration endpointConfiguration)
            : base(hostConfiguration, settings, endpointConfiguration)
        {
            _hostConfiguration     = hostConfiguration;
            _endpointConfiguration = endpointConfiguration;
            _settings = settings;

            HostAddress  = hostConfiguration.HostAddress;
            InputAddress = settings.GetInputAddress(hostConfiguration.HostAddress, settings.Name);
        }
示例#6
0
        HostReceiveEndpointHandle CreateSubscriptionEndpoint(Action <IServiceBusSubscriptionEndpointConfigurator> configure,
                                                             SubscriptionEndpointSettings settings)
        {
            var configuration = _hostConfiguration.CreateSubscriptionEndpointConfiguration(settings);

            configure?.Invoke(configuration.Configurator);

            BusConfigurationResult.CompileResults(configuration.Validate());

            return(_receiveEndpoints.Start(settings.Path));
        }
        public IServiceBusSubscriptionEndpointConfiguration CreateSubscriptionEndpointConfiguration(string topicPath, string subscriptionName)
        {
            if (_hosts.Count == 0)
            {
                throw new ConfigurationException("At least one host must be configured");
            }

            var settings = new SubscriptionEndpointSettings(topicPath, subscriptionName);

            return(_hosts[0].CreateSubscriptionEndpointConfiguration(settings));
        }
示例#8
0
        public ServiceBusSubscriptionEndpointConfiguration(IServiceBusHostConfiguration hostConfiguration,
                                                           SubscriptionEndpointSettings settings, IServiceBusEndpointConfiguration endpointConfiguration)
            : base(hostConfiguration, settings, endpointConfiguration)
        {
            _hostConfiguration     = hostConfiguration;
            _endpointConfiguration = endpointConfiguration;
            _settings = settings;

            HostAddress   = hostConfiguration.HostAddress;
            _inputAddress = new Lazy <Uri>(FormatInputAddress);
        }
示例#9
0
        public void CreateSubscriptionEndpoint(SubscriptionEndpointSettings settings, Action <IServiceBusSubscriptionEndpointConfigurator> configure)
        {
            var consumePipe = _builder.CreateConsumePipe();

            var endpointConfigurator = new ServiceBusSubscriptionEndpointSpecification(_host, settings, consumePipe);

            configure?.Invoke(endpointConfigurator);

            BusConfigurationResult.CompileResults(endpointConfigurator.Validate());

            endpointConfigurator.Apply(_builder);
        }
        public void CreateSubscriptionEndpoint(SubscriptionEndpointSettings settings, Action<IServiceBusSubscriptionEndpointConfigurator> configure)
        {
            var consumePipe = _builder.CreateConsumePipe();

            var endpointConfigurator = new ServiceBusSubscriptionEndpointSpecification(_host, settings, consumePipe);

            configure?.Invoke(endpointConfigurator);

            BusConfigurationResult.CompileResults(endpointConfigurator.Validate());

            endpointConfigurator.Apply(_builder);
        }
        public void CreateSubscriptionEndpoint(SubscriptionEndpointSettings settings, Action <IServiceBusSubscriptionEndpointConfigurator> configure)
        {
            var endpointConfiguration = _configuration.CreateNewConfiguration();

            var endpointConfigurator = new ServiceBusSubscriptionEndpointSpecification(_host, settings, endpointConfiguration, _sendTransportProvider);

            configure?.Invoke(endpointConfigurator);

            BusConfigurationResult.CompileResults(endpointConfigurator.Validate());

            endpointConfigurator.Apply(_builder);
        }
示例#12
0
        public HostReceiveEndpointHandle ConnectSubscriptionEndpoint <T>(string subscriptionName, Action <IServiceBusSubscriptionEndpointConfigurator> configure = null)
            where T : class
        {
            if (_subscriptionEndpointFactory == null)
            {
                throw new ConfigurationException("The subscription endpoint factory was not specified");
            }

            var settings = new SubscriptionEndpointSettings(Topology.Publish <T>().TopicDescription, subscriptionName);

            _subscriptionEndpointFactory.CreateSubscriptionEndpoint(settings, configure);

            return(_receiveEndpoints.Start(settings.Path));
        }
示例#13
0
        public Task <HostReceiveEndpointHandle> ConnectSubscriptionEndpoint(string subscriptionName, string topicName,
                                                                            Action <IServiceBusSubscriptionEndpointConfigurator> configure)
        {
            if (SubscriptionEndpointFactory == null)
            {
                throw new ConfigurationException("The subscription endpoint factory was not specified");
            }

            var settings = new SubscriptionEndpointSettings(topicName, subscriptionName);

            SubscriptionEndpointFactory.CreateSubscriptionEndpoint(settings, configure);

            return(_receiveEndpoints.Start(settings.Path));
        }
示例#14
0
        HostReceiveEndpointHandle ConnectSubscriptionEndpoint(SubscriptionEndpointSettings settings,
                                                              Action <IServiceBusSubscriptionEndpointConfigurator> configure)
        {
            LogContext.SetCurrentIfNull(DefaultLogContext);

            LogContext.Debug?.Log("Connect subscription endpoint: {Topic}/{SubscriptionName}", settings.Path, settings.Name);

            var configuration = _hostConfiguration.CreateSubscriptionEndpointConfiguration(settings, configure);

            BusConfigurationResult.CompileResults(configuration.Validate());

            configuration.Build(this);

            return(ReceiveEndpoints.Start(configuration.Settings.Path));
        }
        public ServiceBusSubscriptionEndpointConfiguration(IServiceBusHostConfiguration hostConfiguration,
                                                           IServiceBusEndpointConfiguration endpointConfiguration,
                                                           SubscriptionEndpointSettings settings)
            : base(hostConfiguration, endpointConfiguration, settings)
        {
            _hostConfiguration     = hostConfiguration;
            _endpointConfiguration = endpointConfiguration;
            _settings = settings;

            HostAddress  = hostConfiguration.Host.Address;
            InputAddress = new UriBuilder(hostConfiguration.Host.Address)
            {
                Path = settings.Name
            }.Uri;
        }
示例#16
0
        HostReceiveEndpointHandle ConnectSubscriptionEndpoint(SubscriptionEndpointSettings settings,
                                                              Action <IServiceBusSubscriptionEndpointConfigurator> configure)
        {
            LogContext.SetCurrentIfNull(DefaultLogContext);

            var configuration = _hostConfiguration.CreateSubscriptionEndpointConfiguration(settings, configure);

            TransportLogMessages.ConnectSubscriptionEndpoint(configuration.InputAddress, settings.Name);

            BusConfigurationResult.CompileResults(configuration.Validate());

            configuration.Build(this);

            return(ReceiveEndpoints.Start(configuration.Settings.Path));
        }
        public void CreateSubscriptionEndpoint(SubscriptionEndpointSettings settings, Action <IServiceBusSubscriptionEndpointConfigurator> configure)
        {
            if (!_configuration.TryGetHost(_host, out var hostConfiguration))
            {
                throw new ConfigurationException("The host was not properly configured");
            }

            var configuration = hostConfiguration.CreateSubscriptionEndpointConfiguration(settings);

            configure?.Invoke(configuration.Configurator);

            BusConfigurationResult.CompileResults(configuration.Validate());

            configuration.Build();
        }
 public ServiceBusSubscriptionEndpointSpecification(IServiceBusHost host, SubscriptionEndpointSettings settings, IConsumePipe consumePipe = null)
     : base(host, settings, consumePipe)
 {
     _settings = settings;
 }
示例#19
0
 public ServiceBusSubscriptionEndpointSpecification(IServiceBusHost host, SubscriptionEndpointSettings settings, IConsumePipe consumePipe = null)
     : base(host, settings, consumePipe)
 {
     _settings = settings;
 }
 public IServiceBusSubscriptionEndpointConfiguration CreateSubscriptionEndpointConfiguration(SubscriptionEndpointSettings settings)
 {
     return(new ServiceBusSubscriptionEndpointConfiguration(this, _busConfiguration.CreateEndpointConfiguration(), settings));
 }