Exemple #1
0
        KafkaProducer CreateQueueClient(string queue)
        {
            CreateTopicIfNotExists(queue);
            var queueClient = new KafkaProducer(queue, _zkConnectionString);

            return(queueClient);
        }
Exemple #2
0
        KafkaProducer GetQueueClient(string queue)
        {
            KafkaProducer queueClient = _queueClients.TryGetValue(queue);

            if (queueClient == null)
            {
                queueClient = CreateQueueClient(queue);
                _queueClients.GetOrAdd(queue, queueClient);
            }
            return(queueClient);
        }
Exemple #3
0
        KafkaProducer GetTopicClient(string topic)
        {
            KafkaProducer topicClient = null;

            _topicClients.TryGetValue(topic, out topicClient);
            if (topicClient == null)
            {
                topicClient = CreateTopicClient(topic);
                _topicClients.GetOrAdd(topic, topicClient);
            }
            return(topicClient);
        }