Exemplo n.º 1
0
        public HostReceiveEndpointHandle ConnectSubscriptionEndpoint <T>(string subscriptionName,
                                                                         Action <IServiceBusSubscriptionEndpointConfigurator> configure = null)
            where T : class
        {
            LogContext.SetCurrentIfNull(_hostConfiguration.LogContext);

            var endpointConfiguration = _hostConfiguration.CreateSubscriptionEndpointConfiguration <T>(subscriptionName, configure);

            return(ConnectSubscriptionEndpoint(endpointConfiguration));
        }
Exemplo n.º 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();
            }));
        }
Exemplo n.º 3
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));
        }
Exemplo n.º 4
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));
        }
Exemplo n.º 5
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));
        }