You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by Rakesh Nair <ra...@gmail.com> on 2012/08/24 01:36:09 UTC

Producer request in kafka-0.8

The current project i am doing requires producer requests to be
acknowledged by kafka. Since this fix seems to have gone into kafka0.8 i
thought of trying it out. I have a question on whether to use Producer
class or SyncProducer class for sending the request.
I am using Producer class for sending the request now.

Properties props = getProp();
ProducerConfig config = new ProducerConfig(props);
Producer<String, String> producer = new Producer<String, String>(config);
....

In the props i have added two new properties
"producer.request.required.acks", and "producer.request.timeout.ms".  Then
i create a ProducerData object and then use "send" method in the Producer
class.

Does this ensure that the synchronous send happens with ack's ?? Or should
be using SyncProducer for this purpose.

-- 
Regards
Rakesh Nair

Re: Producer request in kafka-0.8

Posted by Neha Narkhede <ne...@gmail.com>.
In addition to this, you want to ensure that "producer.type" is set to
"sync". That will ensure the send is synchronous with acks.

Thanks,
Neha

On Thu, Aug 23, 2012 at 4:36 PM, Rakesh Nair <ra...@gmail.com> wrote:
> The current project i am doing requires producer requests to be
> acknowledged by kafka. Since this fix seems to have gone into kafka0.8 i
> thought of trying it out. I have a question on whether to use Producer
> class or SyncProducer class for sending the request.
> I am using Producer class for sending the request now.
>
> Properties props = getProp();
> ProducerConfig config = new ProducerConfig(props);
> Producer<String, String> producer = new Producer<String, String>(config);
> ....
>
> In the props i have added two new properties
> "producer.request.required.acks", and "producer.request.timeout.ms".  Then
> i create a ProducerData object and then use "send" method in the Producer
> class.
>
> Does this ensure that the synchronous send happens with ack's ?? Or should
> be using SyncProducer for this purpose.
>
> --
> Regards
> Rakesh Nair