public KafkaTransportContext(ISendPipe sendPipe, IHostConfiguration hostConfiguration, KafkaTopicAddress topicAddress) : base(hostConfiguration) { SendPipe = sendPipe; HostAddress = hostConfiguration.HostAddress; TopicAddress = topicAddress; }
public KafkaTransportContext(ISendPipe sendPipe, IHostConfiguration hostConfiguration, KafkaTopicAddress topicAddress, IProducerContextSupervisor <TKey, TValue> supervisor) : base(hostConfiguration) { _hostConfiguration = hostConfiguration; _supervisor = supervisor; SendPipe = sendPipe; TopicAddress = topicAddress; }
public ProducerContextSupervisor(string topicName, ISendPipe sendPipe, SendObservable sendObservers, IClientContextSupervisor clientContextSupervisor, IHostConfiguration hostConfiguration, IHeadersSerializer headersSerializer, Func <ProducerBuilder <TKey, TValue> > producerBuilderFactory) : base(new ProducerContextFactory <TKey, TValue>(clientContextSupervisor, headersSerializer, producerBuilderFactory)) { _sendObservers = sendObservers; _hostConfiguration = hostConfiguration; _topicAddress = new KafkaTopicAddress(hostConfiguration.HostAddress, topicName); _sendPipe = sendPipe; clientContextSupervisor.AddSendAgent(this); }
public ITopicProducer <TKey, TValue> GetProducer <TKey, TValue>(Uri address, ConsumeContext consumeContext) where TValue : class { if (address == null) { throw new ArgumentNullException(nameof(address)); } var topicAddress = new KafkaTopicAddress(_hostAddress, address); KafkaProducerFactory <TKey, TValue> factory = GetProducerFactory <TKey, TValue>(topicAddress); return(factory.CreateProducer(consumeContext)); }
IKafkaProducerFactory <TKey, TValue> GetFactory <TKey, TValue>(KafkaTopicAddress address, IBusInstance busInstance) where TValue : class { if (!_producers.TryGetValue(address.Topic, out var specification)) { throw new ConfigurationException($"Producer for topic: {address} is not configured."); } var factory = _factories.GetOrAdd(address, _ => specification.CreateProducerFactory(busInstance)); if (factory is IKafkaProducerFactory <TKey, TValue> f) { return(f); } throw new ConfigurationException($"Producer for topic: {address} is not configured for ${typeof(Message<TKey, TValue>).Name} message"); }
public TopicProducer(KafkaTopicAddress topicAddress, IKafkaProducerContext <TKey, TValue> context, ConsumeContext consumeContext = null) { _topicAddress = topicAddress; _context = context; _consumeContext = consumeContext; }
public KafkaProducerFactory(KafkaTopicAddress topicAddress, IKafkaProducerContext <TKey, TValue> context) { _context = context; _topicAddress = topicAddress; }