/// <summary> /// Configure Kafka host /// </summary> /// <param name="configurator"></param> /// <param name="server"></param> /// <param name="configure"></param> public static void Host(this IKafkaFactoryConfigurator configurator, string server, Action <IKafkaHostConfigurator> configure = null) { if (configurator == null) { throw new ArgumentNullException(nameof(configurator)); } configurator.Host(new[] { server }, configure); }
public void Register(IKafkaFactoryConfigurator configurator, IRiderRegistrationContext context) { if (_producerConfig != null) { configurator.TopicProducer <TKey, TValue>(_topic, _producerConfig, c => _configure?.Invoke(context, c)); } else { configurator.TopicProducer <TKey, TValue>(_topic, c => _configure?.Invoke(context, c)); } }
public void Register(IKafkaFactoryConfigurator configurator) { if (_keySerializer != null) { _configurations.Add(x => x.SetKeySerializer(_keySerializer)); } if (_valueSerializer != null) { _configurations.Add(x => x.SetValueSerializer(_valueSerializer)); } if (_producerConfig != null) { configurator.TopicProducer <TKey, TValue>(_topic, _producerConfig, c => _configurations.ForEach(x => x(c))); } else { configurator.TopicProducer <TKey, TValue>(_topic, c => _configurations.ForEach(x => x(c))); } }
/// <summary> /// Configure kafka topic producer /// </summary> /// <param name="configurator"></param> /// <param name="topicName">The topic name</param> /// <param name="producerConfig">Producer config</param> /// <param name="configure"></param> /// <typeparam name="TKey">Message key type</typeparam> /// <typeparam name="TValue">Value key type</typeparam> internal static void TopicProducer <TKey, TValue>(this IKafkaFactoryConfigurator configurator, string topicName, ProducerConfig producerConfig, Action <IKafkaProducerConfigurator <TKey, TValue> > configure) where TValue : class { configurator.TopicProducer(topicName, producerConfig, configure); }
/// <summary> /// Configure kafka topic producer /// </summary> /// <param name="configurator"></param> /// <param name="topicName">The topic name</param> /// <param name="configure"></param> /// <typeparam name="T">Value key type</typeparam> internal static void TopicProducer <T>(this IKafkaFactoryConfigurator configurator, string topicName, Action <IKafkaProducerConfigurator <Ignore, T> > configure) where T : class { configurator.TopicProducer(topicName, configure); }
/// <summary> /// Subscribe to kafka topic /// </summary> /// <param name="configurator"></param> /// <param name="topicName">The topic name</param> /// <param name="consumerConfig">Consumer config</param> /// <param name="configure"></param> /// <typeparam name="T">Message value type</typeparam> public static void TopicEndpoint <T>(this IKafkaFactoryConfigurator configurator, string topicName, ConsumerConfig consumerConfig, Action <IKafkaTopicReceiveEndpointConfigurator <Ignore, T> > configure) where T : class { configurator.TopicEndpoint(topicName, consumerConfig, configure); }