Exemplo n.º 1
0
        public bool IsBrokerAlive()
        {
            using (var producer = new KafkaProducer <int>())
            {
                // If Kafka was not alive, then InternalProducer will be null
                if (producer.InternalProducer == null)
                {
                    return(false);
                }

                try
                {
                    //ADLER - producer.InternalProducer.GetMetadata(false, null, TimeSpan.FromSeconds(1));
                }
                catch (KafkaException)
                {
                    return(false);
                }
                catch (Exception)
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        public KafkaProducer <TValue> CreateProducer <TValue>(Dictionary <string, object> config = null)
        {
            var producer = new KafkaProducer <TValue>(config);

            this.TheProducers.Add(producer);
            return(producer);
        }