You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by Yonghui Zhao <zh...@gmail.com> on 2014/05/09 10:00:34 UTC

how to know kafka producer api status

If l use java producer api in sync mode.

  public void send(kafka.producer.KeyedMessage<K,V> message) { /* compiled
code */ }

How to know whether a send process is successful or failed?

For example if the kafka broker disk is not accessible , will it throw
exceptions?

Re: how to know kafka producer api status

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

If you set producer.type = sync, then the send() call will not return until
it have received the ack from the broker, and if the response contains any
error code it will re-try send until all retries exhausted, and then will
throw an exception.

Guozhang


On Fri, May 9, 2014 at 4:18 AM, Yonghui Zhao <zh...@gmail.com> wrote:

> Seems email archive doesn't work now in
> http://mail-archives.apache.org/mod_mbox/kafka-users/201405.mbox/browser
>
> And also I sent email to users-subscribe@kafka.apache.org    to  subscribe
> this group, it doesn't work either.
>
>
> 2014-05-09 16:00 GMT+08:00 Yonghui Zhao <zh...@gmail.com>:
>
> >
> > If l use java producer api in sync mode.
> >
> >   public void send(kafka.producer.KeyedMessage<K,V> message) { /*
> compiled
> > code */ }
> >
> > How to know whether a send process is successful or failed?
> >
> > For example if the kafka broker disk is not accessible , will it throw
> > exceptions?
> >
> >
>



-- 
-- Guozhang

Re: how to know kafka producer api status

Posted by Yonghui Zhao <zh...@gmail.com>.
Seems email archive doesn't work now in
http://mail-archives.apache.org/mod_mbox/kafka-users/201405.mbox/browser

And also I sent email to users-subscribe@kafka.apache.org    to  subscribe
this group, it doesn't work either.


2014-05-09 16:00 GMT+08:00 Yonghui Zhao <zh...@gmail.com>:

>
> If l use java producer api in sync mode.
>
>   public void send(kafka.producer.KeyedMessage<K,V> message) { /* compiled
> code */ }
>
> How to know whether a send process is successful or failed?
>
> For example if the kafka broker disk is not accessible , will it throw
> exceptions?
>
>

Re: how to know kafka producer api status

Posted by Timothy Chen <tn...@gmail.com>.
It typically throws a exception in the end of the sync producer cannot
deliver your message.

In the case where there is a IOException or similiar exceptions that
the Broker cannot deal with, I believe it will try to return
UnknownError response which will then throw in the producer.

In cases where it receives error codes where the producer can recover
from (ie: NotLeaderForPartition), it simply retries up to the
configured max retries.

Tim

On Fri, May 9, 2014 at 1:00 AM, Yonghui Zhao <zh...@gmail.com> wrote:
> If l use java producer api in sync mode.
>
>   public void send(kafka.producer.KeyedMessage<K,V> message) { /* compiled
> code */ }
>
> How to know whether a send process is successful or failed?
>
> For example if the kafka broker disk is not accessible , will it throw
> exceptions?

Re: how to know kafka producer api status

Posted by Jun Rao <ju...@gmail.com>.
Yes, in sync mode, if send() fails, an exception will be thrown.

Thanks,

Jun


On Fri, May 9, 2014 at 1:00 AM, Yonghui Zhao <zh...@gmail.com> wrote:

> If l use java producer api in sync mode.
>
>   public void send(kafka.producer.KeyedMessage<K,V> message) { /* compiled
> code */ }
>
> How to know whether a send process is successful or failed?
>
> For example if the kafka broker disk is not accessible , will it throw
> exceptions?
>