Beispiel #1
0
        public ReceiveEndpoint CreateReceiveEndpoint(IBusInstance busInstance)
        {
            var endpointConfiguration = busInstance.HostConfiguration.CreateReceiveEndpointConfiguration(EndpointName);
            endpointConfiguration.ConnectReceiveEndpointObserver(_endpointObservers);

            var configurator =
                new KafkaTopicReceiveEndpointConfiguration<TKey, TValue>(_hostConfiguration, _consumerConfig, _topicName, busInstance, endpointConfiguration,
                    _headersDeserializer);
            _configure?.Invoke(configurator);

            var result = BusConfigurationResult.CompileResults(configurator.Validate());

            try
            {
                return configurator.Build();
            }
            catch (Exception ex)
            {
                throw new ConfigurationException(result, "An exception occurred creating the Kafka receive endpoint", ex);
            }
        }
        public IKafkaReceiveEndpoint CreateReceiveEndpoint(IBusInstance busInstance)
        {
            var endpointConfiguration = busInstance.HostConfiguration.CreateReceiveEndpointConfiguration($"{KafkaTopicAddress.PathPrefix}/{Name}");

            endpointConfiguration.ConnectReceiveEndpointObserver(_endpointObservers);

            var configurator =
                new KafkaTopicReceiveEndpointConfiguration <TKey, TValue>(_consumerConfig, Name, busInstance, endpointConfiguration, _headersDeserializer);

            _configure?.Invoke(configurator);

            var result = BusConfigurationResult.CompileResults(configurator.Validate());

            try
            {
                return(configurator.Build());
            }
            catch (Exception ex)
            {
                throw new ConfigurationException(result, $"An exception occurred creating the {nameof(IKafkaReceiveEndpoint)}", ex);
            }
        }