You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by Sreenivasulu Nallapati <sr...@gmail.com> on 2014/09/24 15:10:07 UTC

How producer gets the acknowledgement back

Hello,

Can you please help me to get the acknowledgement  in producer?


After setting the property  *request.required.acks to 1, *how producer gets
the acknowledgement back? I am trying to get the acknowledgement in java
producer.





Thanks

Sreeni

Re: How producer gets the acknowledgement back

Posted by Steven Wu <st...@gmail.com>.
It may be too late to change the Producer API now.

I always find "ListenableFuture" is very nice/usable. It essentially adds
callback to Future. It's a lot easier to chain/combine ListenableFuture.
http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/util/concurrent/ListenableFuture.html

On Wed, Sep 24, 2014 at 6:05 PM, Guozhang Wang <wa...@gmail.com> wrote:

> Hi,
>
> In the new (Java) producer, you can pass in a callback function in the
>
> Future<RecordMetadata> send(ProducerRecord record, Callback callback)
>
> call, which will be triggered when the ack is received.
>
> Alternatively, you can also call Future.get() on the returned future
> metadata, which will block until the ack is received (i.e., synced
> sending).
>
> Guozhang
>
> On Wed, Sep 24, 2014 at 6:10 AM, Sreenivasulu Nallapati <
> sreenu.nallapati@gmail.com> wrote:
>
> > Hello,
> >
> > Can you please help me to get the acknowledgement  in producer?
> >
> >
> > After setting the property  *request.required.acks to 1, *how producer
> gets
> > the acknowledgement back? I am trying to get the acknowledgement in java
> > producer.
> >
> >
> >
> >
> >
> > Thanks
> >
> > Sreeni
> >
>
>
>
> --
> -- Guozhang
>

Re: How producer gets the acknowledgement back

Posted by Guozhang Wang <wa...@gmail.com>.
Hi,

In the new (Java) producer, you can pass in a callback function in the

Future<RecordMetadata> send(ProducerRecord record, Callback callback)

call, which will be triggered when the ack is received.

Alternatively, you can also call Future.get() on the returned future
metadata, which will block until the ack is received (i.e., synced sending).

Guozhang

On Wed, Sep 24, 2014 at 6:10 AM, Sreenivasulu Nallapati <
sreenu.nallapati@gmail.com> wrote:

> Hello,
>
> Can you please help me to get the acknowledgement  in producer?
>
>
> After setting the property  *request.required.acks to 1, *how producer gets
> the acknowledgement back? I am trying to get the acknowledgement in java
> producer.
>
>
>
>
>
> Thanks
>
> Sreeni
>



-- 
-- Guozhang