public static ProducerConfig ToProducerConfig(this INetStreamConfigurationContext config) { return(new ProducerConfig() { BootstrapServers = config.BootstrapServers }); }
public IMessageProducer <TKey, TMessage> Create <TKey, TMessage>(INetStreamConfigurationContext config) { var producer = new ProducerBuilder <TKey, TMessage>(config.ToProducerConfig()) .SetValueSerializer(new HeaderSerializationStrategy <TMessage>()) .Build(); return(new NetStreamProducer <TKey, TMessage>(producer)); }
public static ProducerConfig ToProducerConfig(this INetStreamConfigurationContext config) { var producerConfig = new ProducerConfig() { BootstrapServers = config.BootstrapServers, }; config.AuthenticationMethod.Apply(producerConfig); return(producerConfig); }
public static ConsumerConfig ToConsumerConfig(this INetStreamConfigurationContext config) { return(new ConsumerConfig() { BootstrapServers = config.BootstrapServers, GroupId = config.ConsumerGroup, EnableAutoCommit = true, AutoOffsetReset = AutoOffsetReset.Earliest }); }
public static ProducerConfig ToProducerConfig(this INetStreamConfigurationContext config) { return(new ProducerConfig() { BootstrapServers = config.BootstrapServers, SecurityProtocol = ParseSecurityProtocol(config), SslCertificateLocation = config.SslCertificateLocation, SslCaLocation = config.SslCaLocation, SslKeyLocation = config.SslKeyLocation, SslKeyPassword = config.SslKeyPassword }); }
public static ConsumerConfig ToConsumerConfig(this INetStreamConfigurationContext config) { var consumerConfig = new ConsumerConfig() { BootstrapServers = config.BootstrapServers, GroupId = config.ConsumerGroup, EnableAutoCommit = config.DeliveryMode.EnableAutoCommit, AutoCommitIntervalMs = config.DeliveryMode.AutoCommitIntervalMs, AutoOffsetReset = config.AutoOffsetReset, }; config.AuthenticationMethod.Apply(consumerConfig); return(consumerConfig); }
public TopicCreator(INetStreamConfigurationContext configuration, ILog log) { _log = log; var adminConfig = new AdminClientConfig { BootstrapServers = configuration.BootstrapServers, }; configuration.AuthenticationMethod.Apply(adminConfig); var adminClientBuilder = new AdminClientBuilder(adminConfig); _adminClient = new Lazy <IAdminClient>(() => adminClientBuilder.Build()); }
public static SecurityProtocol?ParseSecurityProtocol(this INetStreamConfigurationContext config) { if (!string.IsNullOrEmpty(config.SecurityProtocol)) { if (Enum.TryParse <SecurityProtocol>(config.SecurityProtocol, true, out var securityProtocol)) { return(securityProtocol); } else { throw new ArgumentException(nameof(config.SecurityProtocol)); } } return(null); }
public static ConsumerConfig ToConsumerConfig(this INetStreamConfigurationContext config) { return(new ConsumerConfig() { BootstrapServers = config.BootstrapServers, GroupId = config.ConsumerGroup, EnableAutoCommit = config.DeliveryMode.EnableAutoCommit, AutoCommitIntervalMs = config.DeliveryMode.AutoCommitIntervalMs, AutoOffsetReset = AutoOffsetReset.Earliest, SecurityProtocol = ParseSecurityProtocol(config), SslCertificateLocation = config.SslCertificateLocation, SslCaLocation = config.SslCaLocation, SslKeyLocation = config.SslKeyLocation, SslKeyPassword = config.SslKeyPassword }); }
public TopicCreator(INetStreamConfigurationContext configuration, ILog log) { _log = log; var adminConfig = new AdminClientConfig { BootstrapServers = configuration.BootstrapServers, SslCertificateLocation = configuration.SslCertificateLocation, SslCaLocation = configuration.SslCaLocation, SslKeyLocation = configuration.SslKeyLocation, SslKeyPassword = configuration.SslKeyPassword, SecurityProtocol = configuration.ParseSecurityProtocol() }; var adminClientBuilder = new AdminClientBuilder(adminConfig); _adminClient = new Lazy <IAdminClient>(() => adminClientBuilder.Build()); }
public IConsumer <TKey, T> Create <TKey, T>(INetStreamConfigurationContext config) { return(((Mock <IConsumer <TKey, T> >)_mock).Object); }
public IMessageProducer <TKey, TMessage> Create <TKey, TMessage>(string topic, INetStreamConfigurationContext config) { return(((Mock <IMessageProducer <TKey, TMessage> >)_mock).Object); }
public IConsumer <TKey, TValue> Create <TKey, TValue>(INetStreamConfigurationContext config) { return(new ConsumerBuilder <TKey, TValue>(config.ToConsumerConfig()) .SetValueDeserializer(new HeaderSerializationStrategy <TValue>()) .Build()); }