public static IClientBuilder AddKafkaConfig(this IClientBuilder clientBuilder) { return(clientBuilder .AddKafka("KafkaStreamProvider") .WithOptions(options => { options.BrokerList = new[] { Constants.KafkaHost }; options.ConsumerGroupId = "orleans-kafka"; options.Topics = new List <TopicConfig> { new TopicConfig { Name = Constants.KafkaTopic } }; //options.AddTopic(Constants.KafkaTopic); }) .AddJson() .Build()); }
public virtual void Configure(IConfiguration configuration, IClientBuilder clientBuilder) => clientBuilder .AddKafka(Consts.KafkaStreamProvider) .WithOptions(options => { options.BrokerList = TestBase.Brokers; options.ConsumerGroupId = "E2EGroup_client"; options .AddExternalTopic <TestModelAvro>(Consts.StreamNamespaceExternalAvro) ; options.PollTimeout = TimeSpan.FromMilliseconds(10); options.ConsumeMode = ConsumeMode.StreamEnd; }) .AddAvro("https://[host name]/schema-registry") .Build() .ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(RoundTripGrain).Assembly).WithReferences()) ;
public virtual void Configure(IConfiguration configuration, IClientBuilder clientBuilder) => clientBuilder .AddKafka(Consts.KafkaStreamProvider) .WithOptions(options => { options.BrokerList = TestBase.Brokers; options.ConsumerGroupId = "E2EGroup"; options .AddTopic(Consts.StreamNamespace) .AddTopic(Consts.StreamNamespaceAuto2, new TopicCreationConfig { AutoCreate = true }) ; options.PollTimeout = TimeSpan.FromMilliseconds(10); options.ConsumeMode = ConsumeMode.StreamEnd; }) .Build() .ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(RoundTripGrain).Assembly).WithReferences());
/// <summary> /// Registers Kafka Stream Provider with given name and configurations. /// The KafkaStreamClientBuilder is built here. /// </summary> /// <param name="clientBuilder">The <see cref="IClientBuilder"/>.</param> /// <param name="providerName">The name which will be used to register the stream provider.</param> /// <param name="kafkaBuilderConfig">The delegate which will be used to configure <see cref="KafkaStreamClientBuilder"/>.</param> /// <returns></returns> public static IClientBuilder AddKafkaStreamProvider([NotNull] this IClientBuilder clientBuilder, [NotNull] string providerName, [NotNull] Action <KafkaStreamClientBuilder> kafkaBuilderConfig) { if (clientBuilder == null) { throw new ArgumentNullException(nameof(clientBuilder)); } if (string.IsNullOrWhiteSpace(providerName)) { throw new ArgumentException($"'{nameof(providerName)}' must not be null, empty or whitespace.", nameof(providerName)); } if (kafkaBuilderConfig == null) { throw new ArgumentNullException(nameof(kafkaBuilderConfig)); } var kafkaBuilder = clientBuilder.AddKafka(providerName); kafkaBuilderConfig(kafkaBuilder); return(kafkaBuilder.Build()); }