Пример #1
0
 /// <summary>
 /// Sends a request to Kafka.
 /// </summary>
 /// <param name="request">The request to send to Kafka.</param>
 public void Send(MultiProducerRequest request)
 {
     if (request.IsValid())
     {
         using (KafkaConnection connection = new KafkaConnection(Server, Port))
         {
             connection.Write(request);
         }
     }
 }
Пример #2
0
        public void IsValidTrue()
        {
            List<ProducerRequest> requests = new List<ProducerRequest>
            { 
                new ProducerRequest("topic a", 0, new List<Message> { new Message(new byte[10]) }),
                new ProducerRequest("topic a", 0, new List<Message> { new Message(new byte[10]) }),
                new ProducerRequest("topic b", 0, new List<Message> { new Message(new byte[10]) }),
                new ProducerRequest("topic c", 0, new List<Message> { new Message(new byte[10]) })
            };

            MultiProducerRequest multiRequest = new MultiProducerRequest(requests);
            Assert.IsTrue(multiRequest.IsValid());
        }
Пример #3
0
 public void IsValidNullRequests()
 {
     MultiProducerRequest multiRequest = new MultiProducerRequest(null);
     Assert.IsFalse(multiRequest.IsValid());
 }
Пример #4
0
 public void IsValidNoRequests()
 {
     MultiProducerRequest multiRequest = new MultiProducerRequest(new List<ProducerRequest>());
     Assert.IsFalse(multiRequest.IsValid());
 }