You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Sugumar J <ma...@gmail.com> on 2015/09/25 16:56:40 UTC

Kafka net Synchronous Producer

Dear all,

I am trying to send message to kafka using kafka-Net (c#).

I want to send message synchronously

i am using below code to achieve this


*var x= client.SendMessageAsync("dynamictopic1", new[] { message });*
*var response = await x;*

Now the response contains the offset details

If i am using .wait() methods its return only bool not offset detail

Is there any way to achieve to send message synchronously without using
await keyword


Thanks,
Sugumar J

Re: Kafka net Synchronous Producer

Posted by gh...@gmail.com.
If you are using the new producer, the send api returns a future on which you can do a .get() to be sure that the message has made it to Kafka and than do another send. I am not sure if the .Net producer that you are referring to exposes this functionality.


Thanks,

Mayuresh

Sent from my iPhone

> On Sep 25, 2015, at 7:56 AM, Sugumar J <ma...@gmail.com> wrote:
> 
> Dear all,
> 
> I am trying to send message to kafka using kafka-Net (c#).
> 
> I want to send message synchronously
> 
> i am using below code to achieve this
> 
> 
> *var x= client.SendMessageAsync("dynamictopic1", new[] { message });*
> *var response = await x;*
> 
> Now the response contains the offset details
> 
> If i am using .wait() methods its return only bool not offset detail
> 
> Is there any way to achieve to send message synchronously without using
> await keyword
> 
> 
> Thanks,
> Sugumar J