IsValid() public method

Determines if the request has valid settings.
public IsValid ( ) : bool
return bool
コード例 #1
0
ファイル: Producer.cs プロジェクト: Bny12/kafka
 /// <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());
 }