public BeginWrite ( Kafka.Client.ProducerRequest request ) : void | ||
request | Kafka.Client.ProducerRequest | The request to make. |
return | void |
/// <summary> /// Send a request to Kafka asynchronously. /// </summary> /// <remarks> /// If the callback is not specified then the method behaves as a fire-and-forget call /// with the callback being ignored. By the time this callback is executed, the /// <see cref="RequestContext.NetworkStream"/> will already have been closed given an /// internal call <see cref="NetworkStream.EndWrite"/>. /// </remarks> /// <param name="request">The request to send to Kafka.</param> /// <param name="callback"> /// A block of code to execute once the request has been sent to Kafka. This value may /// be set to null. /// </param> public void SendAsync(ProducerRequest request, MessageSent <ProducerRequest> callback) { if (request.IsValid()) { KafkaConnection connection = new KafkaConnection(Server, Port); if (callback == null) { // fire and forget connection.BeginWrite(request.GetBytes()); } else { // execute with callback connection.BeginWrite(request, callback); } } }
/// <summary> /// Send a request to Kafka asynchronously. /// </summary> /// <remarks> /// If the callback is not specified then the method behaves as a fire-and-forget call /// with the callback being ignored. By the time this callback is executed, the /// <see cref="RequestContext.NetworkStream"/> will already have been closed given an /// internal call <see cref="NetworkStream.EndWrite"/>. /// </remarks> /// <param name="request">The request to send to Kafka.</param> /// <param name="callback"> /// A block of code to execute once the request has been sent to Kafka. This value may /// be set to null. /// </param> public void SendAsync(ProducerRequest request, MessageSent<ProducerRequest> callback) { if (request.IsValid()) { KafkaConnection connection = new KafkaConnection(Server, Port); if (callback == null) { // fire and forget connection.BeginWrite(request.GetBytes()); } else { // execute with callback connection.BeginWrite(request, callback); } } }