IsValid() public method

Determines if the request has valid settings.
public IsValid ( ) : bool
return bool
Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 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());
        }
Ejemplo n.º 3
0
 public void IsValidNullRequests()
 {
     MultiProducerRequest multiRequest = new MultiProducerRequest(null);
     Assert.IsFalse(multiRequest.IsValid());
 }
Ejemplo n.º 4
0
 public void IsValidNoRequests()
 {
     MultiProducerRequest multiRequest = new MultiProducerRequest(new List<ProducerRequest>());
     Assert.IsFalse(multiRequest.IsValid());
 }